B1 · Methods that workWorks, and here’s how it scales
Trial division
Divide by every candidate up to √N. The work grows in step with the size of the smallest prime factor: double p, double the work.
The idea
Try 2 and 3, then only numbers of the form 6k ± 1 (every other number is a multiple of 2 or 3, so it can be skipped, like a ). The work is about p/3 divisions, where p is the smallest prime factor. Fine for small factors, hopeless when both factors are huge.
Watch it
Fig. B1.1Every candidate divisor up to just past p
4 skipped by the 6k ± 1 wheel5 tried, no luckp divides N· never reached
How it scales
A slope of 1 on this log-log chart means the work grows in step with p. Rho, shown for comparison, grows only like √p.
Fig. B1.2Divisions needed as the smallest factor grows
Running the race…