Project Euler 10: Summation of primes – SOLVED

Project Euler 10 Problem Statement The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. Solution Using our prime number sieve introduced in problem 7 this is easy to solve in less than 100ms with a couple lines of...

Project Euler 11: Largest product in a grid – SOLVED

Project Euler 11 Problem Statement Project Euler 11: In the 20×20 grid below, four numbers along a diagonal line have been marked in red. 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 81...

Project Euler 12: Highly divisible triangular number

Project Euler 12 Problem Statement Project Euler 12: The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55,...

Project Euler 13: Large sum – SOLVED

Project Euler 16 Problem Statement Work out the first ten digits of the sum of the following one-hundred 50-digit numbers. 3710728753390210279879799822083759024651013574025046376937677490009712648124896970078050417018260538 … {data continues} Solution Summing a...

Project Euler 14: Longest Collatz sequence

Project Euler 14 Problem Statement Originally published on blog.dreamshire.com, M. Molony, MAY 18, 2009. The following iterative sequence is defined for the set of positive integers: n → n/2 (n is even) n → 3n + 1 (n is odd) Using the rule above and starting...

Project Euler 17: Numbers to words

Project Euler 17 Problem Statement If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many...

Project Euler 18: Maximum path sum I

Project Euler 18 Problem Statement Originally published on blog.dreamshire.com, M. Molony, APRIL 1, 2009. By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23. 3 7 5 2 4 6 8 5 9 3 That...

Project Euler 19: Counting Sundays – SOLVED

Project Euler 19 Problem Statement Originally published on blog.dreamshire.com, M. Molony, MARCH 26, 2009. You are given the following information, but you may prefer to do some research for yourself. A leap year occurs on any year evenly divisible by 4, but not on a...