Goodstein Sequence: Difference between revisions

Content deleted Content added
Petelomax (talk | contribs)
m →‎{{header|Phix}}: simplified, added gmp version
Petelomax (talk | contribs)
m →‎gmp version: added a 17th term
Line 333: Line 333:
end for
end for
printf(1,"\n")
printf(1,"\n")
printf(1,"The Nth term of Goodstein(N) sequence counting from 0, for values of N from 0 through 16:\n")
printf(1,"The Nth term of Goodstein(N) sequence counting from 0, for values of N from 0 through 17:\n")
for i=0 to 16 do
for i=0 to 17 do
string gs = mpz_get_short_str(goodstein(i,i+1)[$])
string gs = mpz_get_short_str(goodstein(i,i+1)[$])
printf(1,"Term %d of Goodstein(%d): %s\n",{i,i,gs})
printf(1,"Term %d of Goodstein(%d): %s\n",{i,i,gs})
Line 340: Line 340:
</syntaxhighlight>
</syntaxhighlight>
{{out}}
{{out}}
As above, except ending with
As above, except ending for the last four and an extra term being accurate:
<pre>
<pre>
Term 13 of Goodstein(13): 6568408355712901455
Term 13 of Goodstein(13): 6568408355712901455
Line 346: Line 346:
Term 15 of Goodstein(15): 14063084452070776884879
Term 15 of Goodstein(15): 14063084452070776884879
Term 16 of Goodstein(16): 27715173799965169706...68941004114162614925 (862 digits)
Term 16 of Goodstein(16): 27715173799965169706...68941004114162614925 (862 digits)
Term 17 of Goodstein(17): 10685914955539561986...83487458441633279971 (27,776 digits)
</pre>
</pre>