2014-09-11

# Problem 010: Summation of primes

Description:

The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.

Find the sum of all the primes below two million.

Solution:
v
# ... #
. . . .
.  .  .
. . . .
# ... #
>"d"55+*:2**1- >:"#"\:"d"55+2**%\"d"55+2**/1+p:#v_ "d"55+*:2*:10p                          v
^              ^                              -1<  v p05+1*+:5g01p11p10:" "p032p00*p02:    <v            <
> 030p 040p>30g1+:30p:10g% \10g/1+g"X"-|
v                                                  <             _^#`g03g00 <|     - g03g00 < p04+g04 g03<
> "X" 30g:10g%\10g/1+p30g >30g+ : 00g\`     #v_\$>30g1+:30p:10g%\10g/1+g" "- |>40g.@
^p+1/g01\%g01:\" ":<  ^                           <
This program is too big to display/execute here, click [download] to get the full program.

Explanation:

And again a sieve of Eratosthenes (see Problem 7), but this time a lot bigger.

 Interpreter steps: 416 776 174 Execution time (BefunExec): 1min 7s (6.21 MHz) Program size: 2000 x 1007 Solution: 142913828922 Solved at: 2014-09-11

made with vanilla PHP and MySQL, no frameworks, no bootstrap, no unnecessary* javascript