%I #58 Apr 24 2024 11:14:05
%S 3,3,3,2,1,0
%N The Goodstein sequence G_n(3).
%C G_0(m) = m. To get the 2nd term, write m in hereditary base 2 notation (see links), change all the 2s to 3s, and then subtract 1 from the result. To get the 3rd term, write the 2nd term in hereditary base 3 notation, change all 3s to 4s, and subtract 1 again. Continue until the result is zero (by Goodstein's Theorem), when the sequence terminates.
%C Decimal expansion of 33321/100000. - _Natan Arie Consigli_, Jan 23 2015
%H R. L. Goodstein, <a href="http://www.jstor.org/stable/2268019">On the Restricted Ordinal Theorem</a>, J. Symb. Logic 9, 33-41, 1944.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/HereditaryRepresentation.html">Hereditary Representation</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/GoodsteinSequence.html">Goodstein Sequence</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/GoodsteinsTheorem.html">Goodstein's Theorem</a>
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Goodstein's_theorem#Hereditary_base-n_notation">Hereditary base-n notation</a>
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Goodstein's_theorem#Goodstein_sequences">Goodstein sequence</a>
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Goodstein's_theorem">Goodstein's Theorem</a>
%H Reinhard Zumkeller, <a href="/A211378/a211378.hs.txt">Haskell programs for Goodstein sequences</a>
%F a(0) = a(1) = a(2) = 3; a(3) = 2; a(4) = 1; a(n) = 0, n > 4;
%F From _Iain Fox_, Dec 12 2017: (Start)
%F G.f.: 3 + 3*x + 3*x^2 + 2*x^3 + x^4.
%F E.g.f.: 3 + 3*x + (3/2)*x^2 + (1/3)*x^3 + (1/24)*x^4.
%F a(n) = floor(2 - (4/Pi)*arctan(n-3)), n >= 0.
%F (End)
%e a(0) = 3 = 2^1 + 1;
%e a(1) = 3^1 + 1 - 1 = 3^1 = 3;
%e a(2) = 4^1 - 1 = 3;
%e a(3) = 3 - 1 = 2;
%e a(4) = 2 - 1 = 1;
%e a(5) = 1 - 1 = 0.
%t PadRight[CoefficientList[Series[3 + 3 x + 3 x^2 + 2 x^3 + x^4, {x, 0, 4}], x], 6] (* _Michael De Vlieger_, Dec 12 2017 *)
%o (Haskell) -- See Link
%o (PARI) B(n, b)=sum(i=1, #n=digits(n, b), n[i]*(b+1)^if(#n<b+i, #n-i, B(#n-i, b)))
%o a(n) = my(x=3); for(i=1, n, x=B(x, i+1)-1; if(x==0, break())); x \\ (uses definition of sequence) _Iain Fox_, Dec 13 2017
%o (PARI) first(n) = my(res = vector(n)); res[1] = res[2] = res[3] = 3; res[4] = 2; res[5] = 1; res; \\ _Iain Fox_, Dec 12 2017
%o (PARI) first(n) = Vec(3 + 3*x + 3*x^2 + 2*x^3 + x^4 + O(x^n)) \\ _Iain Fox_, Dec 12 2017
%o (PARI) a(n) = floor(2 - (4/Pi)*atan(n-3)) \\ _Iain Fox_, Dec 12 2017
%Y Cf. A056004, A057650, A059934, A059935, A059936, A271977.
%Y Cf. A056041, A056193, A266204, A271554, A222117, A059933, A211378.
%K cons,easy,nonn,fini,full
%O 0,1
%A _Jonathan Sondow_, Aug 10 2012
%E Corrected by _Natan Arie Consigli_, Jan 23 2015