Learn R Programming

bigIntegerAlgos (version 0.1.2)

quadraticSieve: Prime Factorization with the Quadratic Sieve

Description

Get the prime factorization of a number, \(n\), using the Quadratic Sieve.

Usage

quadraticSieve(n)

Arguments

n

An integer, numeric, string value, or an element of class bigz.

Value

Vector of class bigz

Details

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.

References

See Also

factorize

Examples

Run this code
# NOT RUN {
mySemiPrime <- prod(nextprime(urand.bigz(2, 40, 17)))
quadraticSieve(mySemiPrime)
# }

Run the code above in your browser using DataLab