Fortran Implementation of Problem 10
View source code here on GitHub!
Includes
Problem Solution
- integer Problem0010/p0010()
1! Project Euler Problem 10
2!
3! Problem:
4!
5! The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
6!
7! Find the sum of all the primes below two million.
8
9module Problem0010
10 use constants
11 use primes
12 implicit none
13contains
14 integer(i18t) function p0010() result(answer)
15 integer(i18t) :: tmp
16
17 answer = 0
18 tmp = 2
19 call expand_sieve(2001000_i18t)
20 do while (tmp < 2000000_i18t)
21 answer = answer + tmp
22 tmp = next_prime(tmp)
23 end do
24 end function p0010
25end module Problem0010