diff --git a/src/main.c b/src/main.c index 7ac3ff2..8ca64b5 100644 --- a/src/main.c +++ b/src/main.c @@ -1,211 +1,40 @@ #include #include "utils.h" -#include /* - A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given: + Euler discovered the remarkable quadratic formula: - 1/2 = 0.5 - 1/3 = 0.(3) - 1/4 = 0.25 - 1/5 = 0.2 - 1/6 = 0.1(6) - 1/7 = 0.(142857) - 1/8 = 0.125 - 1/9 = 0.(1) - 1/10 = 0.1 - Where 0.1(6) means 0.166666..., and has a 1-digit recurring cycle. It can be seen that 1/7 has a 6-digit recurring cycle. - Find the value of d < 1000 for which 1/d contains the longest recurring cycle in its decimal fraction part. + It turns out that the formula will produce 40 primes for the consecutive integer values . However, when is divisible by 41, and certainly when is clearly divisible by 41. - https://projecteuler.net/problem=26 -*/ + The incredible formula was discovered, which produces 80 primes for the consecutive values . The product of the coefficients, −79 and 1601, is −126479. -boolean isPrime(int*primeList,int primeListSize,int numb) { - for (int i=0;i=1000) { - break; - } else { - primeList=realloc(primeList,sizeof(int)*++primeListSize); - primeList[primeListSize-1]=digit; - } + int startMarker=0; + while (fgetc(f)!='{') { + startMarker++; } + fseek(f,startMarker,SEEK_SET); + int n=0; + while (true) { + for (int a=1;a<1000;a++) { + for (int b=1;b<=1000;b++) { - while (divisor<1000) { - divider=10; //We always start with 10. - sequenceLength=0; - sequenceRepeat=0; - for (int i=0;i0&&found<20) { - for (int i=0;i