Sum of primes in odd positions is prime: Difference between revisions
Content added Content deleted
(→{{header|REXX}}: added the computer programming language REXX.) |
|||
Line 70: | Line 70: | ||
119 653 17,959 |
119 653 17,959 |
||
143 823 26,879 |
143 823 26,879 |
||
</pre> |
|||
=={{header|Julia}}== |
|||
{{trans|Factor}} |
|||
<lang julia>using Primes |
|||
p = primes(1000) |
|||
arr = filter(n -> isprime(n[2]), accumulate((x, y) -> (y, x[2] + y), p[1:2:length(p)], init = (0, 0))) |
|||
println(join(arr, "\n")) |
|||
</lang>{{out}} |
|||
<pre> |
|||
(2, 2) |
|||
(5, 7) |
|||
(31, 89) |
|||
(103, 659) |
|||
(149, 1181) |
|||
(331, 5021) |
|||
(467, 9923) |
|||
(499, 10909) |
|||
(523, 11941) |
|||
(653, 17959) |
|||
(823, 26879) |
|||
</pre> |
</pre> |
||