← RoseCode

ROSECODE 396

The Goodstein Sequence

Philippe_57721 · Programming ·

We define the hereditary base-n representation of a number as follow:
For instance, if n=266, and base=2, its hereditary base-2 representation is:
266=21+23+28
=21+21+2+223
=21+21+2+221+2
We express n in base 2 and recursively every exponent in base 2.

Let's define the Gk sequence as follow:
G1(n)=n
G2(n)= Take the hereditary base-2 representation of n, replace each 2s with 3s and substract 1
Gk(n)= Take the hereditary base-k representation of Gk1(n), replace each ks with (k+1)s and substract 1

Here the first values for Gk(6)
G1(6)=6
G2(6)=29
G3(6)=257
G4(6)=3125
G5(6)=46655
G6(6)=98039
G7(6)=187243
G8(6)=332147

Find G50(13)

[My timing: < 1 sec]