public static int CirculuarPrimes(int n) { PrimeFunctions.GeneratePrimesTillNToList(1000000); PrimeFunctions.ConvertToHash(); int count = 0; for (int i = 2; i < n; i++) { List <int> rots = CombinatoricFunctions.rotations(i); bool prime = true; foreach (int rot in rots) { if (!PrimeFunctions.PrimeListHash.Contains(rot)) { prime = false; break; } } if (prime) { count++; //Console.WriteLine(i); } } return(count); }