摘要:
static bool IsPrime(int n) { return Enumerable.Range(2, (int)Math.Sqrt(n) - 1).All(i => n % i != 0); }相关知识一:Enumerable.Range MethodGenerates a sequence of integral numbers within a specified range.Namespace: System.LinqAssembly: System.Core (in System.Core.dll)public... 阅读全文