Problem 13 of Project Euler is a bit different than the others we’ve done; we don’t even need to us PL/SQL to solve it!
Problem 13:
Large Sum
Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.
37107287533902102798797998220837590246510135740250
46376937677490009712648124896970078050417018260538
74324986199524741059474233309513058123726617309629
91942213363574161572522430563301811072406154908250
23067588207539346171171980310421047513778063246676
89261670696623633820136378418383684178734361726757
28112879812849979408065481931592621691275889832738
44274228917432520321923589422876796487670272189318
……
To solve this problem, I simple imported the 100 numbers into a table in SQL, then ran a SUM function on the first 11 digits to find what the first 10 would be.
SELECT SUM(SUBSTR(num,1,11)) FROM num_input; --output: 5537376230
Questions or comments? Feel free to leave them below or reach out to me on Twitter!