static bool IsPrime(int n) { return Enumerable.Range(2, (int) Math.Sqrt(n)-1).All(i => n%i != 0); }