Пример #1
0
        public void TestIsPrimeByMillerRabin()

        {
            Assert.IsFalse(ToolsMathBigIntegerPrime.IsPrimeByMillerRabin(4), "4 is not prime");
            Assert.IsFalse(ToolsMathBigIntegerPrime.IsPrimeByMillerRabin(8), "8 is not prime");
            Assert.IsFalse(ToolsMathBigIntegerPrime.IsPrimeByMillerRabin(9), "9 is not prime");

            Assert.IsTrue(ToolsMathBigIntegerPrime.IsPrimeByMillerRabin(2), "2 is prime");
            Assert.IsTrue(ToolsMathBigIntegerPrime.IsPrimeByMillerRabin(3), "3 is prime");
            Assert.IsTrue(ToolsMathBigIntegerPrime.IsPrimeByMillerRabin(11), "11 is prime");
            Assert.IsTrue(ToolsMathBigIntegerPrime.IsPrimeByMillerRabin(13), "13 is prime");
            Assert.IsTrue(ToolsMathBigIntegerPrime.IsPrimeByMillerRabin(17), "17 is prime");
            Assert.IsTrue(ToolsMathBigIntegerPrime.IsPrimeByMillerRabin(23), "23 is prime");
            Assert.IsTrue(ToolsMathBigIntegerPrime.IsPrimeByMillerRabin(997), "997  is prime");
        }