Close

A modular modulus

A project log for A Tiny Sieve | Lehmer's Math Machine in ATtinys

Until the late 1990s, this device outperformed general purpose computers at certain number theory problems.

kbsriramkbsriram • 09/08/2026 at 18:54•0 Comments

At the end of the last build, my 3 moduli let 740,000 of 5.68 million candidates through, and the Pico spent 23 minutes checking them. The sieve was idle 92% of the time - filter-bound, generating survivors faster than the Pico could check them.

I need more moduli. Twelve would drop checking to a few seconds, and the 1932 gear machine ran 30. So it's time to leave the breadboard and make each modulus a card I can plug into a backplane.

The hardware

My plan is a stripboard bus with female headers, with each modulus an ATtiny412 on a card standing vertically in it. All pins come out to one edge, with a decoupling cap on the card. I want to keep the UPDI programming pin free. SDA and SCL sit on PA1 and PA2. That leaves PA3, PA6 and PA7 for REQ, VOTE and one spare. PA7 has the peripherals I'm least likely to need, so it drives an onboard LED and each card blinks its own vetoes.

The schematic is an ATtiny412, a decoupling cap, an LED with its resistor, and a header. The one addition is a jumper that ties PA7 to a header pin, in case I want that line off the card instead of the LED.

Routing fits entirely on the top layer. I rounded the traces for the look of a hand-drawn PCB, and rounded one corner so I can check that 30 cards are all seated the same way.

I drew the schematic and board in JLCPCB's online editor and picked parts they stock so the boards arrive assembled. Hand-soldering 30 sets of SMD parts is not something I want to do, so the header pins are all I have to solder.

Thirty boards came to $81 with shipping and tariffs, or around $2.70 a modulus. Each board is identical, since the modulus is loaded over I2C at the start of a run.

Gerbers, Altium source and the JLCPCB BOM are in the GitHub repo  if you want to order your own.

Discussions