Sylvester's sequence: Difference between revisions
Content added Content deleted
Catskill549 (talk | contribs) (added AWK) |
Alextretyak (talk | contribs) (Added 11l) |
||
Line 24: | Line 24: | ||
* [[oeis:A000058|OEIS A000058 - Sylvester's sequence]] |
* [[oeis:A000058|OEIS A000058 - Sylvester's sequence]] |
||
<br> |
<br> |
||
=={{header|11l}}== |
|||
{{trans|Nim}} |
|||
<lang 11l>F sylverster(lim) |
|||
V result = [BigInt(2)] |
|||
L 2..lim |
|||
result.append(product(result) + 1) |
|||
R result |
|||
V l = sylverster(10) |
|||
print(‘First 10 terms of the Sylvester sequence:’) |
|||
L(item) l |
|||
print(item) |
|||
V s = 0.0 |
|||
L(item) l |
|||
s += 1 / Float(item) |
|||
print("\nSum of the reciprocals of the first 10 terms: #.17".format(s))</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 terms: 0.99999999999999982 |
|||
</pre> |
|||
=={{header|ALGOL 68}}== |
=={{header|ALGOL 68}}== |