# bprichar/Project-Euler

4-19-12

1 parent 1cd6cb0 commit e4f1e427f7dc1750b8931dc11f88ba33cbe0a98a committed Apr 19, 2012
Showing with 22 additions and 34 deletions.
1. +22 −0 primefact.f90
2. +0 −17 problem1.f90
3. +0 −17 problem2.f90
22 primefact.f90
 @@ -0,0 +1,22 @@ +Program problem3 +Implicit Integer (Selected_Int_Kind(16)) (I-N) +! Find the largest prime factor of a number +!nEND = 600851475143 +nEND = 6857 +I = 1 +Do +I = I+1 + Do + If ( mod(nEND,I) == 0 ) Then + nEND = nEND/I + Else + Exit + End If + End Do + If ( I >= nEND ) Then + Exit + End If +End Do +Print *,'I = ',I + +End Program problem3
17 problem1.f90
 @@ -1,17 +0,0 @@ -Program problem1 -!Sum all multiples of 3 or 5 that are less than iUP -iUP = 1000 -nSUM = 0 -Do i = 3, iUP-1, 3 - nSUM = nSUM + i -End Do -Do i = 5, iUP-1, 5 - If ( mod(i,3) == 0 ) Then - Cycle - Else - nSUM = nSUM + i - End If -End Do -Print *, ' Sum is ',nSUM - -End Program problem1
17 problem2.f90
 @@ -1,17 +0,0 @@ -Program problem2 -! Claculate the sum of all even numbers in the Fibonacci sequence less than istop -istop = 4000000 -Ifibn_1 = 1 -Ifibn = 2 -nSUM = 2 -Do - Do I = 1, 3 - Ifibn = Ifibn_1+Ifibn - Ifibn_1 = Ifibn-Ifibn_1 - End Do - If ( Ifibn > istop ) Exit - nSUM = nSUM + Ifibn -End Do -Print *, 'Sum is ',nSUM - -End Program problem2