Exemple #1
0
 public static BigInteger GreatestCommonDivisor(this BigInteger a, BigInteger b)
 {
     Extreme.Mathematics.BigInteger emA    = ToUnsignedExtremeMathematics(a);
     Extreme.Mathematics.BigInteger emB    = ToUnsignedExtremeMathematics(b);
     Extreme.Mathematics.BigInteger result = IntegerMath.GreatestCommonDivisor(emA, emB);
     return(ToUnsignedBigInteger(result));
 }
Exemple #2
0
        public void GreatestCommonDivisorBigInteger()
        {
            BigInteger a        = 2 * 3 * 5 * 7;
            BigInteger b        = 3 * 5 * 7;
            BigInteger c        = 2 * 5 * 7;
            BigInteger expected = 5 * 7;
            BigInteger actual   = IntegerMath.GreatestCommonDivisor(a, b, c);

            Assert.AreEqual(expected, actual);
        }
Exemple #3
0
        public void GreatestCommonDivisorInt()
        {
            int a        = 2 * 3 * 5 * 7;
            int b        = 3 * 5 * 7;
            int c        = 2 * 5 * 7;
            int expected = 5 * 7;
            int actual   = IntegerMath.GreatestCommonDivisor(a, b, c);

            Assert.AreEqual(expected, actual);
        }