Sum of primes in odd positions is prime: Difference between revisions
Sum of primes in odd positions is prime (view source)
Revision as of 14:19, 5 September 2021
, 2 years ago→{{header|ALGOL 68}}: Use the new prime list routines in Algol 68-primes
(Added Algol 68) |
(→{{header|ALGOL 68}}: Use the new prime list routines in Algol 68-primes) |
||
Line 12:
{{libheader|ALGOL 68-primes}}
<lang algol68>BEGIN # find primes (up to 999) p(i) for odd i such that the sum of primes p(j), j = 1, 3, 5, ..., i is prime #
INT max prime = 999;▼
PR read "primes.incl.a68" PR
▲ INT max prime = 999;
[]BOOL prime = PRIMESIEVE 50 000; # guess that the max sum will be <= 50 000 #
[]INT
# find the sums of the odd primes and test for primality #
print( ( " i p[i] sum", newline ) );
|