Poulet Number Calculator
Number Theory
- A Poulet number is a composite number n that passes the base-2 Fermat test: 2^(n-1) leaves remainder 1 when divided by n, exactly as a prime would.
- Every odd composite up to 10,000 is tested. Primes are excluded first, since a pseudoprime only counts when it is genuinely composite.
- The scan finds 22 Poulet numbers at or below 10,000. The smallest is 341, which factors as 11 x 31 yet still fools the base-2 test.
- The largest at or below the limit is 8,911. Unlike Carmichael numbers, Poulet numbers only have to fool base 2; a Carmichael number fools every base coprime to it.
A primality test that sometimes lies needs its liars catalogued. The Fermat test declares n probably prime when 2^(n-1) mod n equals 1 - a condition every true prime satisfies. The composite numbers that satisfy it anyway are called Fermat pseudoprimes to base 2, and in the older literature, after the Belgian mathematician who tabulated them, Poulet numbers.
This calculator enumerates them exactly: every odd composite up to your limit is checked against the congruence, and the Poulet numbers are listed and counted. Up to 1,000 there are just 3. Up to 10,000 there are 22. Up to 50,000, 55 - thinning out, but never stopping: infinitely many exist.
The smallest, 341, repays a close look. It is 11 x 31, unmistakably composite - and it passes the base-2 test with room to spare.
Worked examples
Up to 10,000
(10000)
| Poulet numbers found | 22 |
| Smallest Poulet number | 341 |
| Largest at or below the limit | 8,911 |
| First 12 found | 341, 561, 645, 1,105, 1,387, 1,729, 1,905, 2,047, 2,465, 2,701, 2,821, 3,277 |
Up to 1,000
(1000)
| Poulet numbers found | 3 |
| Smallest Poulet number | 341 |
| Largest at or below the limit | 645 |
| First 12 found | 341, 561, 645 |
Up to 50,000
(50000)
| Poulet numbers found | 55 |
| Smallest Poulet number | 341 |
| Largest at or below the limit | 49,981 |
| First 12 found | 341, 561, 645, 1,105, 1,387, 1,729, 1,905, 2,047, 2,465, 2,701, 2,821, 3,277 |
The Fermat test and its liars
Fermat's little theorem guarantees that for prime p, 2^(p-1) mod p = 1. The converse is the trap: the congruence holding does not guarantee primality. A composite n with 2^(n-1) mod n = 1 is a liar for the base-2 test - a witness-based test with base 2 alone would wave it through as prime.
Poulet numbers are rare enough to feel safe and common enough to matter. Among odd composites below 50,000 they number 55; a testing scheme that stopped at base 2 would misclassify every one of them, which is why real-world primality testing stacks multiple bases or uses tests with no liars at all.
341 taken apart
The smallest Poulet number factors as 341 = 11 x 31. The congruence works because of a happy alignment: the order of 2 modulo 11 is 10, and modulo 31 it is 5, and both 10 and 5 divide 340. So 2^340 is 1 modulo each factor, hence 1 modulo their product.
That mechanism - the exponent n-1 being a common multiple of the orders modulo each prime factor - generates every Poulet number. It also explains why they are scarce: the alignment has to happen across all factors at once.
Poulet versus Carmichael
A Carmichael number passes the Fermat test for every base coprime to it; a Poulet number needs to pass only for base 2. Every Carmichael number is therefore a Poulet number, but most Poulet numbers are not Carmichael numbers. 561, the smallest Carmichael number, sits in both lists; 341 appears only here.
The distinction matters practically. Adding base 3 to the test kills 341 (it fails base 3) but cannot touch 561, which fools all bases. That is why Carmichael numbers, not Poulet numbers, forced the move to stronger tests like Miller-Rabin with multiple bases and to deterministic proofs.
Reading the enumeration
The calculator reports the count, the smallest (always 341 once the limit reaches it) and the largest in range, plus the first twelve values so the spacing is visible: 341, 561, 645, 1,105, 1,387, 1,729 and onward - gaps widening as the numbers grow.
The search itself is honest brute force: primality by trial division to exclude true primes, then a modular exponentiation for the congruence. At the maximum limit of 100,000 it still finishes quickly, because modular exponentiation needs only about seventeen multiplications per candidate.
Why cryptographers care
Any system that generates prime numbers for keys - RSA key generation being the famous case - lives or dies by its primality test. Pseudoprimes are the failure mode. A single-base Fermat test would eventually certify a Poulet number as prime and produce a broken key.
Modern practice answers with Miller-Rabin rounds at several random bases (where liars are vanishingly rare and bounded by theory) or with deterministic tests at key sizes that allow them. The Poulet numbers remain the cleanest classroom demonstration of why the naive test is not enough.
A note on the name
Paul Poulet published extensive tables of these pseudoprimes in the 1930s, computed by hand and correspondence - the 55 below 50,000 on this page were, for him, a life's work of arithmetic. The modern term 'Fermat pseudoprime to base 2' is more descriptive, but the older name honours the tabulation that made the phenomenon impossible to ignore.
How the count behaves
The counts on this page - 3 below a thousand, 22 below ten thousand, 55 below fifty thousand - grow slower than any power of the limit, roughly in step with the count of primes themselves thinned by a harsh filter. Heuristics model Poulet numbers as composites whose prime factors' orders all divide n - 1, a condition that becomes exponentially fussier as factors multiply.
Yet they never stop: constructions exist that manufacture infinitely many, typically by starting from one Poulet number and building larger ones whose factors inherit the alignment. Rarity and infinitude coexist comfortably here.
Base matters
Poulet numbers are defined against base 2, but every base has its own pseudoprimes. A number can fool base 2 and fail base 3 - 341 does exactly that - which is the practical engine behind multi-base testing: each additional base catches the liars tuned to the previous ones.
The numbers that fool several specified bases simultaneously are rarer still and have their own literature. The arms race between liar construction and test design is a genuinely useful one: it produced the Miller-Rabin test, whose liars are provably scarce for every composite.
Poulet's tables and their era
Poulet computed his tables in an era of hand arithmetic and postal collaboration, hunting pseudoprimes into the tens of millions. Errors crept in and were corrected by later tabulators - a reminder that the enumeration this page performs in milliseconds was once measured in lifetimes.
The modern OEIS sequence A001567 continues his table indefinitely, and the verification standard has inverted: today a claimed Poulet number is doubted until a machine checks it, where Poulet's readers had to trust the arithmetic of a man with a pencil.
Orders: the engine underneath
The mechanism section mentioned orders of 2 modulo each prime factor. That idea - the multiplicative order - organizes all of pseudoprime theory: n fools base 2 exactly when the order of 2 modulo every prime factor of n divides n - 1 (with a small print clause for repeated factors). Carmichael numbers are those where the stronger Korselt condition holds for the number as a whole.
Once stated that way, the rarity is obvious: n - 1 must be a common multiple of several unrelated orders simultaneously, a coincidence that thins rapidly as n grows - yet constructions force the coincidence, which is why infinitely many exist.
Poulet numbers in testing software
Historical primality code that relied on a single Fermat round - and some did - carried a quantifiable bug rate set by these numbers. Modern libraries document their test chains precisely because the Poulet phenomenon taught the field that 'passes the test' is meaningless without specifying which test, at which bases, with what error bound.
When you read that a system uses Miller-Rabin with fixed bases for 64-bit inputs, the invisible footnote is this page's subject: below 2^64, seven specific bases are proven to have no liars at all - the Poulet problem, engineered away.
A hand verification
Check 341 the slow way if you doubt the machinery: the order of 2 modulo 11 is 10 and the order of 2 modulo 31 is 5, and 340 is a multiple of both, so 2^340 is 1 modulo each factor - hence 1 modulo 341, by the Chinese remainder theorem. Three lines, and the smallest liar stands explained.
Every Poulet number submits to the same three-line style of explanation after the fact. Finding them is the computation; explaining them is the theory.
Euler pseudoprimes and stronger liars
A stricter relative demands that Euler-Jacobi criterion also hold, halving the liar population again; 341 survives even that test for base 2, making it an Euler pseudoprime too. Each strengthening - Fermat, Euler, strong - prunes the liars without eliminating them, a staircase of tests approaching certainty asymptotically.
The staircase is the practical history of primality testing in miniature: certainty is not a test but a limit, and engineering is choosing where on the staircase your error budget lets you stand.
FAQs
What is a Poulet number?
A composite number n satisfying 2^(n-1) mod n = 1 - in other words, a Fermat pseudoprime to base 2.
What is the smallest Poulet number?
341, which factors as 11 x 31 yet passes the base-2 Fermat test.
How many Poulet numbers are below 10,000?
22, running from 341 up to 8,911.
Is 561 a Poulet number?
Yes - and it is also a Carmichael number, meaning it fools the Fermat test at every base, not just base 2.
How many Poulet numbers are below 50,000?
55, the largest being 49,981.
Are there infinitely many Poulet numbers?
Yes - infinitely many Fermat pseudoprimes to base 2 exist, though they grow steadily rarer.
Do Poulet numbers fool the Miller-Rabin test too?
A single Miller-Rabin round is stronger than the Fermat test, and 341 is caught by most bases; more importantly, Miller-Rabin liars are provably rare for every composite, and several rounds make error negligible - which is why it replaced the Fermat test in practice.
What is the largest Poulet number below 10,000?
8,911 - the last of the 22 Poulet numbers in that range.