Fortran Implementation of Problem 7
View source code here on GitHub!
Includes
Problem Solution
- integer Problem0007/p0007()
1! Project Euler Problem 7
2!
3! Problem:
4!
5! By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that
6! the 6th prime is 13.
7!
8! What is the 10 001st prime number?
9
10module Problem0007
11 use constants
12 use primes
13 implicit none
14contains
15 integer(i18t) function p0007() result(answer)
16 integer :: i
17
18 answer = 1
19 call expand_sieve(2_i18t**17)
20 do i = 1, 10001
21 answer = next_prime(answer)
22 end do
23 end function p0007
24end module Problem0007