Large sum


Fork me on GitHub
2014-09-11

Problem 013: Large sum

Description:

Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.

...

Solution:
v     // Project Euler - Problem 13
      37107287533902102798797998220837590246510135740250
      ...
#     53503534226472524250874054075591789781264330331690
=

         v_v#                   <               <1<
>510p"d"20p>"0"10g20gp10g1-:10p#^_510p20g1-:20p#^_^
v       $<
>"7"10pv>10g20gg" "-!#v_       >10g20gg"0"-00g+00p v
v30p021< >10g1-10p55+/00p   v  |-" "gg02g01p02+1g02<
>0p0::p ^^p021pg02g01+"0"%+55:<>0v
        ^             "#   $< ^g0<
v          p02"e"p010$<
>10g1+:10p20gg"0"-!#v_55+00p>00g:1-00p!#@_54+00g-10g+20gg,v
^                   <       ^                             <
This program is too big to display/execute here, click [download] to get the full program.

Explanation:

Here I do simply do a column addition. After the sum is calculated, we take the first 10 digits and print them


Interpreter steps: 244 792
Execution time (BefunExec): 78ms (3.14 MHz)
Program size: 59 x 113
Solution: 5537376230
Solved at: 2014-09-11



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