Generates a weak goodstein sequence using c++