Revision: 50680
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 30, 2011 06:17 by FMalk
Initial Code
static List<int> findPrimes(int max) { var vals = new List<int>((int)(max / (Math.Log(max) - 1.08366))); var maxSquareRoot = Math.Sqrt(max); var eliminated = new BitArray(max + 1); vals.Add(2); for (int i = 3; i <= max; i += 2) { if (!eliminated[i]) { if (i < maxSquareRoot) { for (int j = i * i; j <= max; j += 2 * i) eliminated[j] = true; } vals.Add(i); } } return vals; }
Initial URL
Initial Description
Initial Title
Prime Numbers Generator
Initial Tags
Initial Language
C#