WebRobot

Blog · Artificial Intelligence, Technology, Data Analytics

We Profiled a Claimed Polynomial-Time Factorization Algorithm. Here's Exactly Where It Breaks.

· Roger Giuffrè

Every few years a manuscript appears announcing the end of RSA: a deterministic, polynomial-time algorithm that factors any integer. If one were correct, it would be among the most important results in the history of computer science — and it would quietly break most of the encryption securing the internet. So when a detailed preprint landed on our desk with exactly that claim, we did the only responsible thing: we implemented it, instrumented it, and let the profiler settle the argument.

The verdict, in one line: the algorithm is correct but not polynomial. It recovers the true factors every time — and its real cost grows like n0.71, i.e. exponentially in the number of bits. Below we show precisely where the gap between the theorems and the machine lies, because it is a beautiful, instructive gap — and because the idea underneath it is genuinely good, just pointed at the wrong conclusion.

What the algorithm actually does

Stripped of its notation, the method is Fermat's factorization, reparametrized. For an integer n coprime to 6, it searches for a value a such that n + (3a ± ε)² is a perfect square b²; any such a immediately yields a factorization of n as a difference of squares. That part is classical and completely sound.

On top of it sits the clever ingredient: a quadratic-residue sieve over a small base of auxiliary primes p₁ < p₂ < … < ps. For each prime, being a solution forces a necessary condition — the reparametrized quantity must be a quadratic residue modulo that prime. An honest, independent, cheap filter per prime. If this feels familiar to anyone who has read about the quadratic sieve, that is not a coincidence — it is, almost word for word, the same skeleton.

What the paper gets right

Here is the part worth defending. The paper's central counting result — that after sieving by all the auxiliary primes, only about O(log n) candidate values of a survive every necessary condition — is a legitimate upper bound. We reproduced it exactly. Across every key we tested, the final surviving set had size 1. The theorem is true, the final exhaustive search is tiny, and it recovers the factors.

So the algorithm works. The dispute is not about correctness. It is about cost — and cost is exactly where a profiler earns its keep.

Where it breaks: counting is not constructing

Having few survivors does not mean you can find them cheaply. We instrumented the algorithm to track, at every step, the two faithful ways to represent the surviving set:

  • The explicit list of surviving a values in the search interval. It shrinks geometrically — but it starts at ~n/30, astronomically large for small steps.
  • The compact residue representation — the number of allowed residue classes modulo the product of the primes, ∏|Gh|. It is small early, but it grows monotonically and blows up as the sieve lengthens.

The trap is that there is no step at which both representations are small at the same time. One is huge on the left, the other is huge on the right, and where they cross — the minimum any faithful representation can achieve, which we call the working set — is already enormous. Here is the measured crossover for a 28-bit modulus:

Crossover of the two representations of the AC algorithm: the explicit list falls, the CRT-class count rises, and the working-set envelope peaks between them.
The graph the proof does not show: the explicit list (blue) falls, the compact CRT-class count (red) rises, and the working set (green) — the best any faithful representation can do — peaks between them.

We swept semiprimes from 14 to 28 bits and fit the peak working set against the problem size. The result is unambiguous:

n (bits) final survivors |C| peak working set peak CRT classes
14 1 30 2·10¹⁴
18 1 457 2·10²²
22 1 1,731 10³²
26 1 16,081 7·10⁴⁰
28 1 26,843 2·10⁴⁶
The final survivor count stays at 1 (the theorem holds) — but the working set explodes.

A log–log regression gives working set ≈ n0.71 ≈ 20.71·bits — exponential in the bit-length. Extrapolated to a 2048-bit RSA modulus, the algorithm's minimal faithful working set is on the order of 21458: not merely impractical, but larger than the number of atoms in the observable universe by hundreds of orders of magnitude. The compact route is even worse — the number of CRT residue classes the method must traverse is already 10⁴⁶ at a mere 28 bits.

The proof's step-by-step accounting hides this by treating each sieved set as if its fibers were still complete arithmetic progressions — true before any sieving, false after the first prime. Each single step genuinely costs only ~log n, because it examines the marginal residues of one prime. But that marginal cost is not the joint cost of intersecting all the primes' conditions, and the final "the survivors are few, so exhaustive search is possible" quietly skips the superpolynomial combination that actually produces those survivors.

The better path: the same idea, pointed correctly

Here is the constructive half of the story. The quadratic-residue sieve on a factor base is not a dead end — it is the beating heart of the quadratic sieve, one of the fastest general-purpose factorization algorithms ever built. The difference is what you do with the survivors. Instead of trying to isolate the single simultaneous solution (the superpolynomial wall), you collect many smooth relations and combine them with a single pass of linear algebra modulo 2 to manufacture a congruence of squares.

To make the contrast concrete, we wrote a toy quadratic sieve and pointed it at the same keys. It factored all of them, using a factor base of comparable size and only about as many relations — then one linear-algebra step. Subexponential, feasible, and a world apart from the superpolynomial CRT combination the original method implies. The good idea survives; only the claim of polynomiality does not.

The takeaway for anyone who ships algorithms

This is the lesson we live by when we build data and inference pipelines at WebRobot: an asymptotic argument on paper is a hypothesis, not a result. A "polynomial" label earned by counting can hide an exponential cost in constructing what you counted. The fastest way to find that out is not a longer proof — it is an implementation and a profiler. Half a day of instrumented code turned a 39-page claim into a single, honest graph.

If you work with large-scale data extraction, pricing intelligence, or sentiment analysis, the same discipline applies: measure the real resource curve before you trust the headline complexity. It is exactly the kind of empirical rigor we bake into the WebRobot platform.

Note: this article analyzes a publicly circulated mathematical preprint as a matter of open scientific discussion. We reproduced the authors' construction faithfully and credit what is correct in it; our disagreement is strictly technical and concerns the complexity claim, not the integrity of the work. All code was run against our own test keys. Nothing here constitutes a practical attack on any deployed cryptographic system — the whole point is that the method does not scale.

cryptographyalgorithmsRSAcomputational complexity