Bernstein's 2002 batch factorization algorithm is presented along with a practical Python skeleton and contextualized by its role in speeding the 2020 RSA-240 factorization by about 25%. The write-up situates the method inside number-field-sieve workflows - particularly batch or delayed-target discrete logarithm computations - and notes its use in CADO-NFS-style implementations. It highlights that the algorithm finds all small prime factors below a bound B for a list of integers, making the smoothness-detection stage far more efficient when many targets share the same candidate small primes. Code examples are provided on Colab for readers who want to experiment.
Substantively, the method multiplies all targets, builds a product tree of candidate primes (Algorithm 6.1), and uses a recursive routine (Algorithm 6.3) that applies two-adic division and inverse routines (Algorithm 5.1) to identify which primes divide the combined product, then splits results back to per-integer factors (Algorithm 7.1). The exposition reproduces algorithmic pseudocode and Python implementations for ConstructProductTree, FindDividingPrimes (with TwoAdicDivision/Inverse), and the recursive BernsteinFactorization, and demonstrates expected outputs on a small example.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.