public void SetData()
        {
            // Get Primes to be used
            maxPrimeEvaluate = (int)Math.Ceiling((double)N / 3);
            primes           = new Primes(maxPrimeEvaluate);
            maxPrimeIndex    = primes.lstPrimes.Count - 1;

            // Set factorization of our divisor D
            d = new int[3]; // Only prime factors are 2 and 5
            primes.PrimeFactorization_ArrIdx(multiple, ref d);

            // Create factorial array
            factorials    = new int[N + 1][];
            factorials[0] = new int[] {};
            factorials[1] = new int[] {};

            int[] newVals;
            for (int i = 2; i <= N; i++)
            {
                newVals = factorials[i - 1].ToArray();
                primes.PrimeFactorization_ArrIdx(i, ref newVals, maxPrimeEvaluate);
                factorials[i] = newVals;
            }

            d = new int[3];
            primes.PrimeFactorization_ArrIdx(multiple, ref d, maxPrimeEvaluate);

            var fact200k = factorials[N];
        }
        public void SetData()
        {
            primes        = new Primes(N);
            maxPrimeIndex = primes.lstPrimes.Count;
            factorials    = new int[N + 1][];

            factorials[0] = new int[0];
            factorials[1] = new int[0];

            int[] newVals;

            for (int i = 2; i <= N; i++)
            {
                newVals = factorials[i - 1].ToArray();
                primes.PrimeFactorization_ArrIdx(i, ref newVals, N_MaxEvaluate);
                factorials[i] = newVals;
            }

            int[] divisor = new int[3];
            primes.PrimeFactorization_ArrIdx(multiple, ref divisor);

            nFactorialMinusDivisor = new int[maxPrimeIndex];
            for (int i = 0; i < maxPrimeIndex; i++)
            {
                nFactorialMinusDivisor[i] = factorials[N].GV(i) - divisor.GV(i);
            }

            //Console.WriteLine(maxFactorialDivisor(nFactorialMinusDivisor));
        }
        public void SetData()
        {
            primes        = new Primes(rows);
            maxPrimeIndex = primes.lstPrimes.Count - 1;

            factorials    = new int[rows + 1][];
            factorials[0] = new int[] {};
            factorials[1] = new int[] {};

            int[] newVals;
            for (int i = 2; i <= rows; i++)
            {
                newVals = factorials[i - 1].ToArray();
                primes.PrimeFactorization_ArrIdx(i, ref newVals);
                factorials[i] = newVals;
            }

            added = new HashSet <long>();
            added.Add(1);
        }
示例#4
0
        public void SetData()
        {
            primes  = new Primes(1000);
            factors = new int[] { 2, 5 };

            factorials    = new int[N + 1][];
            factorials[0] = new int[] { 0, 0 };
            factorials[1] = new int[] { 0, 0 };

            for (int i = 2; i <= N; i++)
            {
                factorials[i] = new int[factors.Length];
                for (int j = 0; j < factors.Length; j++)
                {
                    factorials[i][j] = CountFactorialFactorization(i, factors[j]);
                }
            }

            d = new int[factors.Length];
            primes.PrimeFactorization_ArrIdx(multiple, ref d);
            d = new int[] { d[0], d[2] };
        }