static bool IsCircularPrime(Int64 value) { var numbers = value.Split(); // todo permutations with only 13, 31 for 13 (make it) var permutations = numbers.GetPermutations(value.ToString().Length); var rotations = new List<Int64>(); permutations.ToList().ForEach(p => rotations.Add(long.Parse(String.Concat(p)))); return rotations.All(v => ps.Primes.Contains(v)); }