public BalancedNumber(BigInteger number, BigInteger sideSum, BigInteger k, FactorSet factors) { this.number = number; this.sideSum = sideSum; this.k = k; GetKFactorRational(); GetKFactor(); this.primeFactors = factors; }
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)); }
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); }