Sum of primes in odd positions is prime: Difference between revisions
Content added Content deleted
m (→{{header|Wren}}: Minor tidy) |
(added Easylang) |
||
Line 314: | Line 314: | ||
Elapsed Time: 16.077 ms. |
Elapsed Time: 16.077 ms. |
||
</pre> |
|||
=={{header|EasyLang}}== |
|||
{{trans|11l}} |
|||
<syntaxhighlight> |
|||
fastfunc isprim num . |
|||
i = 2 |
|||
while i <= sqrt num |
|||
if num mod i = 0 |
|||
return 0 |
|||
. |
|||
i += 1 |
|||
. |
|||
return 1 |
|||
. |
|||
for p = 2 to 999 |
|||
if isprim p = 1 |
|||
idx += 1 |
|||
if idx mod 2 <> 0 |
|||
s += p |
|||
if isprim s = 1 |
|||
write "(" & idx & " " & p & " " & s & ") " |
|||
. |
|||
. |
|||
. |
|||
. |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
(1 2 2) (3 5 7) (11 31 89) (27 103 659) (35 149 1181) (67 331 5021) (91 467 9923) (95 499 10909) (99 523 11941) (119 653 17959) (143 823 26879) |
|||
</pre> |
</pre> |
||
Line 336: | Line 366: | ||
i=143 p[i]=823 sum=26879 |
i=143 p[i]=823 sum=26879 |
||
</pre> |
</pre> |
||
=={{header|Factor}}== |
=={{header|Factor}}== |
||
{{works with|Factor|0.99 2021-06-02}} |
{{works with|Factor|0.99 2021-06-02}} |