Fortran Implementation of Problem 3

View source code here on GitHub!

Includes

Problem Solution

integer Problem0003/p0003()
 1! Project Euler Problem 3
 2!
 3! Problem:
 4!
 5! The prime factors of 13195 are 5, 7, 13 and 29.
 6!
 7! What is the largest prime factor of the number 600851475143 ?
 8
 9module Problem0003
10    use constants
11    use primes
12    implicit none
13contains
14    integer(i18t) function p0003() result(answer)
15        integer(i18t) :: num = 600851475143_i18t
16        answer = 0
17        do while (num > 1)
18            call prime_factor(num, answer)
19        end do
20    end function p0003
21end module Problem0003

Tags: prime-number, factorization, fortran-iterator