Factoring Lab

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

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

Williams’ p + 1

The sibling of p − 1: it works when p + 1 is smooth. Together the two cover keys that either one misses.

The idea

A is a cousin of the powers aⁿ: it follows Vₙ₊₁ = P·Vₙ − Vₙ₋₁. Taken mod p it repeats with a period that divides p + 1 (half the time) or p − 1 (the other half), depending on whether P² − 4 is a square mod p. So run the sequence out to a number M built from all the small primes. If p + 1 is smooth, V_M ≡ 2 (mod p), and (V_M − 2, N) gives p.

Watch it

B = 1,000. The p + 1 method tries the seeds P = 3, 4, 5 in turn; D = P² − 4 is 5, 12, 21.

The test

100 keys of each special kind (a 26-bit prime with a smooth neighbor and a random 24-bit prime) at B = 1,000, then 200 ordinary random keys for B from 10 to 10,000. Compared with the prediction from .

Fig. B5.2Share of random toy keys that p + 1 splits, against the bound B, with the ρ prediction

Measuring…