This board is based on D. H. Lehmer's 1982 electronic number sieve design: thirty ATtiny412s in place of his ROM and counter pairs, an RP2040 in place of the controlling computer. The run at the end of the video factors 2^79 − 1, stepped at the 5,000 candidates per second of his 1932 gear machine. It finds the factors in 11.3 seconds, against the 12 seconds he published. At its own 500,000 candidates per second, this board can step 100 times faster than that machine.
How number sieves compute without doing arithmetic
Imagine a room of musicians, each following a repeating pattern of claps. One claps every third count. Another claps on counts 1, 4 and 5 of a repeating 5-count pattern. A conductor counts upward, and if any musician claps on a count, that number is thrown out. A number that passes in silence goes off for a separate, expensive check.
A musician's position in their pattern is just the number modulo that pattern length. So each one is testing a single modulus and rejecting certain values of it. Add musicians and fewer numbers survive, so fewer expensive checks are needed. The count itself never has to slow down, because the conductor is just listening for silence.
Each musician in that room is one physical part in a number sieve. In 1928 the Lehmers used 19 musicians: 19 bicycle chains on a common shaft, one chain per modulus, with a twist of chickenwire at each accepted link tripping a microswitch. The switches were wired in series, so a candidate nobody rejected completed the circuit and stopped the motor. A person then read the revolution counter and did the arithmetic.

The 1932 machine replaced the 19 chains with 30 steel gears, adding eleven more moduli. The switches were replaced by a beam of light through aligned holes, detected by a photoelectric cell.

Every number sieve built since has the same two stages, a fast rejecter and a slower checker [LUKES95]. What changed was only what each stage was made of: bicycle chains, then steel gears, then surplus Navy delay lines, then shift registers, then custom VLSI, going from 50 candidates per second in 1928 to 6.4 billion in 1995.
What can you do with it
Say you want to factor 7663 without trial division. If you can write it as a difference of two squares, a² − b² = 7663, the factors fall out as (a+b)(a−b). Rearranged: a² = b² + 7663. So we search for a b where b² + 7663 is a perfect square.
Any a and b satisfying that must also satisfy it in modular arithmetic. Working mod 5, where 7663 is 3, the only squares are 0, 1 and 4. Writing out b² + 3 for every b mod 5 gives 3, 4, 2, 2, 4, so b cannot be 0, 2 or 3 mod 5. That is one musician on a 5-count pattern, rejecting numbers on counts 0, 2 and 3.
Add mod 7 and b also cannot be 0, 1 or 6 mod 7. The first count where both stay silent is b = 4, which is not a solution. The next is b = 9, and 9² + 7663 = 7744 = 88², giving 7663 = 97 × 79. Two musicians cut the values needing a real test from 9 to 2.
About half the values in a modulus are typically rejected. If the moduli are coprime, those rejections are independent, so k moduli leave roughly 1/2^k of the candidates. Any number theory problem you can write as a whole number equation can be brute forced this way.
One ATtiny per musician
Lehmer's 1982 lecture describes a design using a bank of ROM and counter pairs, one per modulus, stepped together by a shared clock. The rest of this is my implementation based on that design, and not a replica.
I combine all thirty outputs on one line, driven by open collector outputs. These can only pull the line low and never drive it high, so any single card can reject a candidate while the others stay silent. The RP2040 loads the bit patterns, drives the clock, and watches that line. If the line stays high on a count, no modulus rejected it, and the RP2040 runs the expensive test on that candidate. If the test fails, clocking resumes.
Three ATtiny412s holding moduli 3, 5 and 7, with a buzzer on the shared line. Each one is added in turn, so you can hear the rejections increase and the surviving candidates become rare.



Each ROM and counter pair is one ATtiny412. The tinys take their modulus and bit pattern over I2C. At startup the controller checks that every card responds, can individually pull the shared line low, and is not shorted to any other line. During a run it periodically pauses and compares every counter against its expected value, checkpointing when they all agree. A card that misses a clock would silently reject at the wrong count and ruin the run, so a failed check rolls the machine back to the last checkpoint.


What running it found
I reran six problems from the 1928 chain machine [LF28] and 1932 gear machine papers [PS33, NF33], with the step rate set to each machine's own speed: 50 candidates per second for the chains, 5,000 for the gears. The chain runs use 19 cards, matching its 19 chains; the gear runs use all 30. Every solution matched the published one, and my times land within 0.5% of the published ones. The full table is in the last build log.
Two of those runs stopped one extra time. On 4,500,383,424,373 as a sum of two squares, the 1928 paper says the machine "stopped only once"; mine stopped 18 minutes earlier at x = 102,151. On 9,999,000,099,990,001 the paper records a stop at x = 400,453; mine stopped 48 minutes earlier at x = 257,749. Both of the values it passed to be tested are quadratic residues of every prime up to 67, the machine's longest chain, and the smallest prime that rejects either one is 73. So the machine as described could not have rejected them, and both would have produced a stop the paper does not list.
The 1933 paper [PS33] also gives the gear machine's period (the count of candidates before every gear returns to its starting tooth) as 2497194316592991015263471297031949336968700272210, which is the product of the first 30 primes with 79 counted twice. But the first four gears in the machine had prime power tooth counts (64, 27, 25, 49, not 2, 3, 5, 7) with the rest being the primes 11 through 113. Those are coprime, so the real period is their product, about 128 times larger.
The 1965 delay line sieve
DLS-127 stepped 1,000,000 candidates per second, twice this board's rate, and its largest modulus was 127, which is also the largest my cards hold. [LLS70] publishes six problems solved on it but no running times, so only the solutions can be compared. All six match.
One of the six behaves differently from every other problem here. It asks for a pseudosquare: the smallest number above 1 that is 1 modulo 8 and a quadratic residue of every odd prime up to 127. Over 50,000 candidates survive the sieve, because every odd perfect square passes all of those tests. DLS-127 printed its survivors on paper and had no way to test one as it arrived, so checking 50,000 of them was not possible. Lehmer instead used the machine's other mode, counting survivors without printing them, calculated the number of perfect squares from a second and much simpler sieve run, and binary searched the range to isolate the single survivor that was not a square. My RP2040 tests each survivor as it comes out and discards the squares without pausing the sieve.
Why these machines lasted, and what ended them
A sieve is fast because rejecting is cheap. It does no arithmetic, so it absorbs every hardware improvement without the complexity of instruction fetches and memory lookups. That is how 50 candidates per second on bicycle chains became 6.4 billion per second in VLSI [LUKES95], and why these machines were still beating general purpose computers into the 1990s.
What ended them was a better algorithm. A sieve still steps through every integer in its range. In 2001 Bernstein showed how to take the same moduli and generate the survivors directly [DJB01], which removed the reason to build the hardware.
Build logs
- The sound of sieving : three ATtinys, a buzzer, and what a sieve sounds like.
- Sieving versus checking : factoring the 1932 number with three moduli, and why it took 25 minutes.
- A modular modulus : designing the modulus card.
- Qualify the moduli : a test jig to assemble the 30 cards.
- The modulus chorus rehearses : testing and bringing up thirty cards on a stripboard backplane.
- The modulus chorus plays for us : the historical runs, with the full results table.
Github link : source for all build logs, schematics, gerbers for modulus board, stripboard layout
kbsriram