Posts  / #POST-215704
REDDIT

Small primes 2-509 before Miller-Rabin?

A
Jan 2, 2026 · 15:27

Primality testing examples found online all say to first check against "a number of" small primes before invoking Miller-Rabin.

For my hobby project in Forth, I've authored a routine to test against the first 97 primes. From 2 through 509, those kept tidily in an array of single bytes.

As a general rule, do the first 97 suffice? Not enough? Too many?