/// <summary> /// Solve the Prime solution /// </summary> /// <returns></returns> public long Solve() { long count, num, total = 0; int index = 0; pg = new PrimeGenerator(LIMIT, out count); TruncablePrimes = new List <long>(); Dictionary <long, List <long> > primes = pg.CreateBlocks(LIMIT, BLOCK_SIZE); num = pg.Primes[index]; while (total != 11) { if (num > 10) { if (TruncRight(num, primes) && TruncLeft(num, primes)) { total++; this.TruncablePrimes.Add(num); Console.WriteLine(String.Format("Index: {0}, Num{1}", total, num)); } } index++; num = pg.Primes[index]; } return(this.TruncablePrimes.Sum()); }
public CircularPrimes() { Primes = new Dictionary <long, List <long> >(); long primeCount; PrimeGenerator pg = new PrimeGenerator(LIMIT, out primeCount); PrimeList = pg.Primes; Primes = pg.CreateBlocks(LIMIT, BLOCK_SIZE); }