Sequence of primes by trial division: Difference between revisions

m
→‎{{header|C sharp}}: tweaked to work properly with limits other than 100.
No edit summary
m (→‎{{header|C sharp}}: tweaked to work properly with limits other than 100.)
Line 513:
}
 
static IEnumerable<int> Primes(int limit) => Enumerable.Range(2, limit-21).Where(IsPrime);
static bool IsPrime(int n) => Enumerable.Range(2, (int)Math.Sqrt(n)-1).All(i => n % i != 0);
}</lang>