Sylvester's sequence: Difference between revisions
Content deleted Content added
imported>Maxima enthusiast No edit summary |
|||
Line 568: | Line 568: | ||
<pre>{2,3,7,43,1807,3263443,10650056950807,113423713055421844361000443,12864938683278671740537145998360961546653259485195807,165506647324519964198468195444439180017513152706377497841851388766535868639572406808911988131737645185443} |
<pre>{2,3,7,43,1807,3263443,10650056950807,113423713055421844361000443,12864938683278671740537145998360961546653259485195807,165506647324519964198468195444439180017513152706377497841851388766535868639572406808911988131737645185443} |
||
0.99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999996349359079841301329356159748234615361531272</pre> |
0.99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999996349359079841301329356159748234615361531272</pre> |
||
=={{header|Maxima}}== |
|||
<syntaxhighlight lang="maxima"> |
|||
sylvester[n]:= if n=0 then sylvester[n]:2 else sylvester[n-1]^2-sylvester[n-1]+1$ |
|||
/* Test cases */ |
|||
makelist(sylvester[i],i,0,9); |
|||
apply("+",1/%); |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
[2,3,7,43,1807,3263443,10650056950807,113423713055421844361000443,12864938683278671740537145998360961546653259485195807,165506647324519964198468195444439180017513152706377497841851388766535868639572406808911988131737645185443] |
|||
27392450308603031423410234291674686281194364367580914627947367941608692026226993634332118404582438634929548737283992369758487974306317730580753883429460344956410077034761330476016739454649828385541500213920805/27392450308603031423410234291674686281194364367580914627947367941608692026226993634332118404582438634929548737283992369758487974306317730580753883429460344956410077034761330476016739454649828385541500213920806 |
|||
</pre> |
|||
=={{header|Nim}}== |
=={{header|Nim}}== |