Factoring Lab

Receipts for factoring ideas: which work, which don’t, and how fast they stop working.

B2 · Methods that workWorks, and here’s how it scales

Pollard’s rho

Repeat x → x² + c. Taken mod the hidden prime p, the sequence loops after about √p steps (the ), and a reveals p.

The idea

Iterate x → x² + c (mod N). We can’t see the sequence mod the secret prime p, but it’s there: it has only p possible values, so it must repeat, and by the it repeats after about √p steps. Drawn out, the values form a tail running into a loop, the shape of the Greek letter ρ. (a tortoise moving one step and a hare moving two) spots the loop, because when they meet mod p, (x_tortoise − x_hare, N) = p.

Watch it

Fig. B2.1The walk x ↦ x² + c, seen mod the hidden prime p

tortoise x_khare x_2kthe cycle

Each step compares the tortoise and the hare with one gcd. Values are shown mod N (what the computer sees) and mod p (the hidden picture).

How it scales

The same seeded toy numbers, factored both ways. On a log-log chart, a slope of 1 means “double p, double the work” and a slope of ½ means “quadruple p, double the work.” That half is the at work.

Fig. B2.2Work against the size of the hidden prime: and rho, same numbers

Running the race…

Try your own number