Sylvester's sequence: Difference between revisions
Content deleted Content added
Add Seed7 |
Drkameleon (talk | contribs) Added Arturo implementation |
||
Line 67:
Sum of reciprocals: +9.99999999999999999999999999999999999999999...999999999999999999999999999964e -1
</pre>
=={{header|Arturo}}==
<lang rebol>sylvester: function [lim][
result: new [2]
loop 2..lim 'x [
'result ++ inc fold result .seed:1 [a b][a * b]
]
return result
]
lst: sylvester 10
print "First 10 terms of the Sylvester sequence:"
print lst
print ""
sumRep: round sum map lst => [1 // &]
print "Sum of the reciprocals of the first 10 items:"
print sumRep</lang>
{{out}}
<pre>First 10 terms of the Sylvester sequence:
2 3 7 43 1807 3263443 10650056950807 113423713055421844361000443 12864938683278671740537145998360961546653259485195807 165506647324519964198468195444439180017513152706377497841851388766535868639572406808911988131737645185443
Sum of the reciprocals of the first 10 items:
1.0</pre>
=={{header|C++}}==
|