quadraticSieve {bigIntegerAlgos} | R Documentation |
Get the prime factorization of a number, n, using the Quadratic Sieve.
quadraticSieve(n)
n |
An integer, numeric, string value, or an element of class bigz. |
First, trial division is carried out to remove small prime numbers, then a modified version of Pollard's rho algorithm that is constrained is called to quickly remove further prime numbers. Next, we check to make sure that we are not passing a perfect power to the main quadratic sieve algorithm. After removing any perfect powers, we finally call the quadratic sieve with multiple polynomials in a recursive fashion until we have completely factored our number.
Vector of class bigz
Joseph Wood
mySemiPrime <- prod(nextprime(urand.bigz(2, 40, 17))) quadraticSieve(mySemiPrime)