Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- If n is small, use trial division.
- A simple algorithm that sometimes works for larger integers is the
- Pollard p - 1 algorithm from 1974 (see page 150). Input: odd
- number n, and bound B:
- Pollard p - 1 factoring algorithm (n; B)
- b := 2
- for j := 2 to B do
- b := bj mod n
- //b congruent 2B! (mod n))
- d := gcd(b - 1; n)
- if 1 < d < n then
- return d
- else
- return "failure"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement