Sum of primes in odd positions is prime: Difference between revisions

Content added Content deleted
Line 811: Line 811:
end sub
end sub


print "p(n)\tsum\n----\t------"
print "i\tp(n)\tsum\n----\t-----\t------"
for n = 2 to 999
for n = 2 to 999
if isPrime(n) then
if isPrime(n) then
Line 817: Line 817:
if mod(i, 2) then
if mod(i, 2) then
sum = sum + n
sum = sum + n
if isPrime(sum) print n, "\t", sum
if isPrime(sum) print i, "\t", n, "\t", sum
end if
end if
end if
end if
next</lang>
next</lang>
{{out}}
{{out}}
<pre>p(n) sum
<pre>i p(n) sum
---- ------
---- ----- ------
2 2
1 2 2
5 7
3 5 7
31 89
11 31 89
103 659
27 103 659
149 1181
35 149 1181
331 5021
67 331 5021
467 9923
91 467 9923
499 10909
95 499 10909
523 11941
99 523 11941
653 17959
119 653 17959
823 26879
143 823 26879
---Program done, press RETURN---
---Program done, press RETURN---</pre>
</pre>