예제 #1
0
            //1,3
            public static bool Start09(ulong exponent, mpz_t mersenneNumber, ref ulong startI, ref mpz_t startS)//3751
            {
                mpz_t s = startS.Clone();

                for (ulong i = startI; i < exponent; i++)
                {
                    mpir.mpz_powm_ui(s, s, 2, mersenneNumber);
                }
                if (startS < mersenneNumber)
                {
                    startI++;
                    startS *= startS;
                }
                return(s == mersenneNumber - 3);
            }
예제 #2
0
            //1,3
            public static bool Start10(ulong exponent, mpz_t mersenneNumber, ref ulong startI, ref mpz_t startS)//3815
            {
                mpz_t s = startS.Clone();

                if ((startI & 1) == 0)
                {
                    mpir.mpz_powm_ui(s, s, 2, mersenneNumber);
                }
                for (ulong i = startI + ((startI - 1) & 1); i < exponent; i += 2)
                {
                    mpir.mpz_powm_ui(s, s, 4, mersenneNumber);
                }
                if (startS < mersenneNumber)
                {
                    startI++;
                    startS *= startS;
                }
                return(s == mersenneNumber - 3);
            }