factoringlab.dev
Receipts for factoring ideas
Every few months someone finds a “pattern in the primes” that might break . This lab tests those ideas with a fixed test and a control, shows the methods that really factor numbers, and measures how fast each one stops working.
Toy numbers only. Every number factored here is generated in your browser and is at most 64 bits. There is no way to load a real key, and the weak-key chapters exist to show why proper key generation rules each weakness out.
How ideas die
Like overfit.bot’s strategy graveyard, every chapter ends in one of these verdicts.
- Just divisibility Fully explained by small primes dividing things.
- do it too Random numbers with the same divisibility show the same effect.
- No leak A test with a working positive control finds no usable information.
- Real, already known A genuine effect predicted by known theory. It doesn’t find factors.
- Works only on weak keys Breaks keys built badly; proper keys are made to avoid it.
- Works, and here’s how it scales A real method. The receipt gives its measured growth rate.
- Real, not yet reachable A true algorithm that needs hardware nobody has built. The receipt is arithmetic on published estimates.
The graveyard
Ideas that don’t workPopular ideas for predicting primes or factoring numbers. Each one looks promising, and each gets a fixed test, a control and a receipt showing where it breaks.
Prime spirals and “new patterns”
Triangles, spirals, hexes and wheels all draw the same small-prime divisibility. Fake primes make the same pictures, and the pattern can’t find the secret prime in N = p × q.
Last digits and digit patterns
Primes past 5 end in 1, 3, 7 or 9, so N, p and q have last-digit rules. It is pure remainder arithmetic, and it never narrows p down.
Machine learning predicts p mod k
Train a model to guess p mod 3, 5 and 7 from N. It sits at chance for all three, while a planted leak is caught every time.
Searching near √N
Fermat’s method is instant when p and q are close together, and hopeless when they are random. Real keys keep them far apart.
Predicting the next prime gap
Gaps look rhythmic, but their statistics match the Cramér and Hardy–Littlewood models. Totals are predictable; the next gap is not.
A neural network on N itself
A small neural net looks at the bits of N for a clue about p. With a hidden nonlinear clue planted it finds it at once; on honest keys it sits at chance.
Benford and the digits of p
Primes’ leading digits follow their own pattern, not Benford’s law. N’s first digit tells you p’s only through the known size of p.
Twin primes: clustering without location
Twin primes are over-represented exactly as Hardy–Littlewood predicts. Trying them first beats counting up, but so does any arbitrary subset of the same size, so twins are not the reason.
Magic sequences: Collatz, Fibonacci, digit sums
Famous number games measured against p mod 4. None beats shuffling, and a planted clue is always caught.
Quantum reality check
What has been factored on quantum hardware (15, 21, with caveats), what RSA-2048 would need on paper, and a short, sober look at post-quantum cryptography.
Methods that work
And how they scaleThe algorithms that really factor numbers, visualized, with charts of how the work grows as the numbers get bigger. That growth rate is the whole story of .
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.
Pollard’s rho
Repeat x → x² + c. Taken mod the hidden prime p, the sequence loops after about √p steps (the birthday paradox), and a gcd reveals p.
Smooth numbers: the idea the next three methods run on
How often numbers have only small factors, against Dickman’s ρ. The one “pattern” that p − 1, the quadratic sieve and ECM all rely on.
Pollard’s p − 1
Fast exactly when p − 1 is made only of small primes. Success rate against the smoothness bound B.
Williams’ p + 1
The sibling of p − 1: it works when p + 1 is smooth. Together the two cover keys that either one misses.
CFRAC: continued fractions before the sieve
The continued fraction of √N hands out squares that are almost N. The method that factored F₇ in 1970 and led straight to the quadratic sieve.
A toy quadratic sieve
Collect smooth values of x² − N, combine them into x² ≡ y² (mod N), and take a gcd. The first sub-exponential method.
Elliptic curves (ECM)
Like p − 1, but every curve is a fresh chance for a smooth group order. Finds medium-size factors of huge numbers.
The number field sieve, explained
The method behind modern factoring records: sieve for pairs where both a − b·m and a norm are smooth. Live for the smallest case, N = m² + 1; the matrix and square-root steps are explained, not run.
Shor’s algorithm, simulated classically
Period finding step by step for N = 15 and 21: the table of powers, the collapse, the Fourier peaks, the continued fraction, the gcd. A simulation, and why it stops at toy size.
The big picture: how far each method reaches
Every method on one chart, and where RSA-2048 sits: far off the edge.
Weak keys
When RSA really breaksbreaks when keys are made badly: shared primes, primes too close together, or primes with a special shape. Demonstrated on toy keys generated in your browser.
Shared factors: batch GCD
1,000 toy keys from a bad random generator; a product tree finds every pair that shares a prime.
p and q too close
Fermat’s method on toy keys with shrinking gaps, and the rule in the standards that prevents it.
Smooth p − 1
Toy keys built with smooth p − 1 fall to Pollard’s p − 1; “safe” primes don’t.
Small private exponent: Wiener’s attack
Choose the private exponent d too small, for speed, and continued fractions of e/N hand it over. An ordinary key is immune.
One message, many keys: Håstad and the common modulus
Send one unpadded message to three people with e = 3, or share a modulus, and the Chinese remainder theorem gives it away.
Known high bits of p: Coppersmith’s lattice
Leak the top half of a prime and a lattice-reduction step recovers the rest. Exact LLL on BigInt, with the limit measured against the prediction. No faster than brute force at toy size, and the page says so.
Structured primes: a toy ROCA
A key generator that builds primes from a hidden pattern leaves a fingerprint in the public number and a short list to search. Flag, then break, at toy size.