diff --git a/archives/2/current b/archives/2/current new file mode 100755 index 0000000..00f3df1 Binary files /dev/null and b/archives/2/current differ diff --git a/archives/3/current b/archives/3/current new file mode 100755 index 0000000..c49448a Binary files /dev/null and b/archives/3/current differ diff --git a/archives/3/src/main.c b/archives/3/src/main.c new file mode 100644 index 0000000..66a013e --- /dev/null +++ b/archives/3/src/main.c @@ -0,0 +1,55 @@ +#include + +/* +The prime factors of 13195 are 5, 7, 13 and 29. + +What is the largest prime factor of the number 600851475143 ? + +https://projecteuler.net/problem=3 +*/ +int main(int argc,char**argv) { + + long primes[10000]; + int primeCount=1; + long primeVal=3; + long highestPrime=1; + primes[0]=2; + long startingNumb=600851475143; + label: + while (startingNumb>1) { + //find the next prime. + char isPrime=1; + for (int i=0;i /* -Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: +The prime factors of 13195 are 5, 7, 13 and 29. -1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... +What is the largest prime factor of the number 600851475143 ? -By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. - -https://projecteuler.net/problem=2 +https://projecteuler.net/problem=3 */ int main(int argc,char**argv) { - int fibStorage[1000]; - int val=0; - int counter=0; - int sum=0; - while (val<4000000) { - if (counter>2) { - val=fibStorage[counter++]=fibStorage[counter-2]+fibStorage[counter-1]; - } else { - val=fibStorage[counter++]=counter; + + long primes[10000]; + int primeCount=1; + long primeVal=3; + long highestPrime=1; + primes[0]=2; + long startingNumb=600851475143; + label: + while (startingNumb>1) { + //find the next prime. + char isPrime=1; + for (int i=0;i