The Agoh–Giuga conjecture: a congruence that detects primes
On this page18 sections
Difficulty 69.5: open since 1950, with a counterexample forced to be both a Carmichael and a Giuga number of at least 13,800 digits, but no argument that the two conditions are incompatible; a sibling of Lehmer's problem (72), slightly lower because the structure of a counterexample is sharper. Application value 3.2: a primality characterization whose false positives are the Carmichael numbers that practical tests already handle. Leverage 8: isolated.
The problem
Does adding the (n−1)-th powers of 1 through n−1 and getting −1 mod n happen only for primes?
- 1Primes pass the power-sum test
- 2Does any composite number pass?
- 3A passer would need 13,800+ digits
- 4None known, none excluded
Modular arithmetic. "" means that and leave the same remainder on division by (in Python, a % n == b % n). "" means the remainder is .
Fermat's little theorem. If is prime and does not divide , then . Try : , and all leave remainder 1.
Giuga's test. Add up . If is prime, each of the terms is , so the sum is . Giuga conjectured in 1950 that the converse also holds: if the sum is , then is prime. For the sum is , and is not a multiple of 6, so 6 fails, as a composite should. For the sum of sixth powers is , and , so 7 passes. Agoh (1995) gave an equivalent form using Bernoulli numbers, the rational numbers that appear in formulas for sums of powers such as .
In Lean. For every : p.Prime ↔ p ∣ 1 + ∑ i ∈ Finset.Ioo 0 p, i^(p - 1). The corpus also states the Bernoulli form and the equivalence of the two; the equivalence is labelled as known, but its Lean proof is still left blank.
What a counterexample would need. Borwein, Borwein, Borwein and Girgensohn (1996) proved that a composite passing the test must be a Carmichael number (a composite that passes Fermat's test for every base coprime to it) and a Giuga number (for every prime dividing , divides ), and must have at least 13,800 digits. An unrefereed Italian working paper by Sorini (2001) is cited for about . Thirteen Giuga numbers are known; the smallest is (check: , , ). All known ones are even, while Carmichael numbers are always odd, so none of them is a counterexample.
Why it is stuck. Each condition is very restrictive, but nobody has shown that a number can never satisfy both at once.
How it is checked. A counterexample is one number plus a computation of the sum modulo that Lean can verify with fast modular exponentiation; a proof must cover every .
Go deeper
The full technical text.
Giuga's form: an integer is prime if and only if Agoh's equivalent form uses Bernoulli numbers: is prime iff . The forward direction (primes satisfy it) follows from Fermat's little theorem; the open part is that no composite satisfies it.
Lean 4 statement (Giuga's formulation) in the Formal Conjectures corpus:
def AgohGiugaSum : Prop := ∀ p ≥ 2, p.Prime ↔
p ∣ 1 + ∑ i ∈ Finset.Ioo 0 p, i^(p - 1 : ℕ)
theorem agoh_giuga.variants.giuga : AgohGiugaSum
Words on this page (6)
- Fermat's little theorem
- For a prime p, raising a number not divisible by p to the power p minus 1 leaves remainder 1 modulo p.
- Bernoulli numbers
- A sequence of rational numbers that appear in formulas for power sums.
- Giuga number
- A composite number n where every prime factor p divides n over p minus 1.
- Carmichael number
- A composite number that passes the Fermat primality test for all bases.
- congruence
- Two numbers have the same remainder after division by n.
- Lehmer's totient problem
- A related unsolved question about a congruence that detects primes.
New to this? Read first (2)
- Agoh–Giuga conjecture (Wikipedia)Statement, equivalent forms and bounds.
- Giuga number (Wikipedia)What a counterexample must look like.
Path to understanding
foundations → problemThe research entries this problem rests on, in the order to read them. Each links to its explainer.
- Start with
- Step 2
- Harmonic analysisTheory
- Step 3
- Then
- The Agoh–Giuga conjecture: a congruence that detects primesThe problem
State of the art
Borwein, Borwein, Borwein and Girgensohn (1996) showed a composite counterexample must be both a Carmichael number and a Giuga number, and would have at least 13,800 digits. Sorini (2001), an Italian working paper whose title describes a heuristic method (Quaderni di Economia, Matematica e Statistica, Urbino), is cited for raising this to about ; it is not refereed, so the 13,800-digit bound is the safe one to quote. Giuga numbers satisfy for every prime ; thirteen are known (the first is , the twelfth has 34 digits), all even, and an odd Giuga number would need at least 14 prime factors. The corpus states the equivalence of the two formulations as a known result (agoh_giuga.variants.equivalence), but its Lean proof is still left as sorry.
Realistic applications
None directly. It belongs to the family of primality characterizations whose false positives (Carmichael-type numbers) are exactly what cryptographic primality tests are designed to avoid.
What counts as solved
A Lean proof of agoh_giuga.variants.giuga (the Bernoulli form agoh_giuga would then follow once the corpus' equivalence statement is also proved in Lean), or an explicit composite with , which the kernel can check.
How it gets verified
To verify: Lean proofA formal proof checked by Lean 4 / Mathlib.
Statement: AgohGiuga.agoh_giuga.variants.giuga (and agoh_giuga for the Bernoulli form, using Mathlib's bernoulli') in formal-conjectures. Mathlib supplies Nat.Prime, Finset.Ioo and Bernoulli numbers (NumberTheory.Bernoulli); the Giuga-number definitions are in the corpus file itself, which also states the equivalence of the two formulations but leaves its proof as sorry, so a proof of one form does not yet give the other in Lean. A counterexample is a single composite that Lean can check by evaluating the power sum modulo (kernel-checkable with fast modular exponentiation lemmas). A proof must cover all . Judge with Comparator against the pinned statement.
Claims
No claimed results on this problem.
Where the work is
The structure theory (Carmichael and Giuga conditions) is the main content; search effort has already pushed the size bound far.
Connected problems
- This problem is related to Lehmer's totient problem: is there a composite n with φ(n) dividing n − 1?Both ask whether a congruence characterizes primes, and any counterexample to either would have to be a Carmichael number.