public static void DoTest() { long[] Result = new long[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37 }; Assert.AreEqual(Result, Sieve.Generate(40)); }
public static long[] Factor(decimal n) { long[] pfactors = Sieve.Generate((long)Math.Sqrt(Convert.ToDouble(n))); List <long> factors = new List <long>(); foreach (var item in pfactors) { while (n % item == 0) { factors.Add(item); n /= item; } } return(factors.ToArray()); }
public static long[] GetCache(decimal n) { return(Sieve.Generate((long)Math.Sqrt(Convert.ToDouble(n)))); }