Sisyphus sequence: Difference between revisions
Content added Content deleted
m (Corrected spelling mistake.) |
|||
Line 307: | Line 307: | ||
77,534,485,877th member is 36 and highest prime needed is 677,121,348,413 |
77,534,485,877th member is 36 and highest prime needed is 677,121,348,413 |
||
</pre> |
</pre> |
||
=={{header|EasyLang}}== |
|||
<syntaxhighlight lang="easylang"> |
|||
func isprim num . |
|||
if num mod 2 = 0 and num > 2 |
|||
return 0 |
|||
. |
|||
i = 3 |
|||
while i <= sqrt num |
|||
if num mod i = 0 |
|||
return 0 |
|||
. |
|||
i += 2 |
|||
. |
|||
return 1 |
|||
. |
|||
prim = 1 |
|||
proc nextprim . . |
|||
repeat |
|||
prim += 1 |
|||
until isprim prim = 1 |
|||
. |
|||
. |
|||
numfmt 0 4 |
|||
n = 1 |
|||
write n |
|||
for i = 2 to 100 |
|||
if n mod 2 <> 0 |
|||
nextprim |
|||
n += prim |
|||
else |
|||
n /= 2 |
|||
. |
|||
write n |
|||
if i mod 10 = 0 |
|||
print "" |
|||
. |
|||
. |
|||
</syntaxhighlight> |
|||
=={{header|J}}== |
=={{header|J}}== |