public Reducer(IReductionAlgorithm <BigInteger> reduction, BigInteger p)
            {
                this.reduction = reduction;
                this.p         = p;
                bLength        = 32;
                b = BigInteger.One << bLength;
                var pLength = p.GetBitLength();

                k  = (pLength - 1) / bLength + 1;
                mu = BigInteger.Pow(b, 2 * k) / p;

                var muLength = mu.GetBitLength();

                length = (pLength + 31) / 32 * 2 + (muLength + 31) / 32;
                store  = new MutableIntegerStore(length);
                muRep  = store.Allocate();
                pRep   = store.Allocate();
                muRep.Set(mu);
                pRep.Set(p);
                bToTheKMinusOneLength = bLength * (k - 1);
                bToTheKPlusOneLength  = bLength * (k + 1);
            }
 public FactorizationAlgorithm(IReductionAlgorithm <T> reduction)
 {
     this.reduction = reduction;
     this.primality = MillerRabin.Create <T>(20, reduction);
 }
 public static IFactorizationAlgorithm <T> Create <T>(IReductionAlgorithm <T> reduction)
 {
     return(new FactorizationAlgorithm <T>(reduction));
 }
 public BigIntegerPollardRhoReduction(int threads, int iterations, IReductionAlgorithm<BigInteger> reduction)
     : base(threads, iterations)
 {
     this.reduction = reduction;
 }
Exemple #5
0
 public Reducer(IReductionAlgorithm <int> reduction, int n)
 {
     this.reduction = reduction;
     this.n         = n;
 }
 public static IPrimalityAlgorithm <T> Create <T>(int k, IReductionAlgorithm <T> reduction)
 {
     return(new PrimalityAlgorithm <T>(k, reduction));
 }
 public PrimalityAlgorithm(int k, IReductionAlgorithm <T> reduction)
 {
     this.k         = k;
     this.reduction = reduction;
 }
 public BigIntegerPollardRhoReduction(int threads, int iterations, IReductionAlgorithm <BigInteger> reduction)
     : base(threads, iterations)
 {
     this.reduction = reduction;
 }
Exemple #9
0
 public Reducer(IReductionAlgorithm <long> reduction, long n)
 {
     this.reduction = reduction;
     this.n         = n;
 }
Exemple #10
0
 public Reducer(IReductionAlgorithm <BigInteger> reduction, BigInteger n)
 {
     this.reduction = reduction;
     this.n         = n;
 }
Exemple #11
0
 public UInt64PollardRhoReduction(IReductionAlgorithm <ulong> reduction)
 {
     this.reduction = reduction;
 }