Summation of primes: Difference between revisions

Content added Content deleted
(Added Algol 68)
(→‎{{header|ALGOL 68}}: no need to check even numbers... doh!)
Line 24: Line 24:
result
result
END # space separate # ;
END # space separate # ;
# sum the primes #
[]BOOL prime = PRIMESIEVE 2 000 000;
[]BOOL prime = PRIMESIEVE 2 000 000;
LONG INT sum := 0;
LONG INT sum := 2;
FOR i TO UPB prime DO
FOR i FROM 3 BY 2 TO UPB prime DO
IF prime[ i ] THEN
IF prime[ i ] THEN
sum +:= i
sum +:= i
FI
FI