Пример #1
0
 public BalancedNumber(BigInteger number, BigInteger sideSum, BigInteger k, FactorSet factors)
 {
     this.number  = number;
     this.sideSum = sideSum;
     this.k       = k;
     GetKFactorRational();
     GetKFactor();
     this.primeFactors = factors;
 }
Пример #2
0
        public static BalancedNumber CreateFromBinaryStream(BinaryReader reader)
        {
            BigInteger number  = BigInteger.Parse(reader.ReadString());
            BigInteger sideSum = BigInteger.Parse(reader.ReadString());
            BigInteger k       = BigInteger.Parse(reader.ReadString());
            FactorSet  factors = ReadPrimeFactors(reader);

            return(new BalancedNumber(number, sideSum, k, factors));
        }
Пример #3
0
        private void GeneratePrimeFactors()
        {
            List <BigInteger> numberFactors             = number.Factorize();
            List <BigInteger> kPrimeFactors             = k.Factorize();
            List <BigInteger> sideSumFactors            = sideSum.Factorize();
            List <BigInteger> kFactorNumeratorFactors   = kFactorRational.Numerator.Factorize();
            List <BigInteger> kFactorDenominatorFactors = kFactorRational.Denominator.Factorize();

            primeFactors = new FactorSet(numberFactors, kPrimeFactors, sideSumFactors, kFactorNumeratorFactors, kFactorDenominatorFactors);
        }