{
  "id": "7609",
  "ident": "NS.07609",
  "slug": "wikipedia-agrawal",
  "title": "Agrawal's conjecture",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "**Agrawal's Primality Conjecture.**\n\nDoes the congruence $(X-1)^n \\equiv X^n - 1 \\pmod{n, X^r-1}$ imply\n$n$ is prime (with a specific exception for $n^2 \\equiv 1 \\pmod{r}$)?\n\nWhile the \"if\" direction is a known theorem, the \"only if\" direction\nremains a conjecture.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "wikipedia",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "AgrawalConjecture.agrawal_conjecture",
  "statement_lean": "theorem agrawal_conjecture :\n    ∀ (n r : ℕ), n > 1 → r > 0 → n.gcd r = 1 →\n      let R := Polynomial (ZMod n)\n      let X : R := Polynomial.X\n      let I : Ideal R := Ideal.span ({X^r - 1} : Set R)\n      Ideal.Quotient.mk I ((X - 1)^n) = Ideal.Quotient.mk I (X^n - 1) →\n      (n.Prime ∨ (n^2 : ZMod r) = 1)",
  "challenge_source": "/-\nCopyright 2026 The Formal Conjectures Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    https://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-/\nmodule\n\npublic import FormalConjecturesUtil\n\n/-!\n# Agrawal's conjecture\n\nAgrawal's conjecture is a stronger version of the theorem that forms the basis\nof the AKS primality test. If true, it would significantly improve the\nefficiency of primality testing.\n\nThe conjecture states that for coprime $n$ and $r$, if the polynomial congruence\n$(X-1)^n \\equiv X^n-1 \\pmod{n, X^r-1}$ holds, then $n$ is either prime or $n^2 \\equiv 1 \\pmod{r}$.\n\n*References:*\n- [Wikipedia](https://en.wikipedia.org/wiki/Agrawal%27s_conjecture)\n- [AIM Math](https://aimath.org/WWN/primesinp/articles/html/50a/)\n- [Paper](https://eprint.iacr.org/2009/008.pdf)\n-/\n\n@[expose] public section\n\nopen Polynomial\n\nnamespace AgrawalConjecture\n\n/--\n**Agrawal's Primality Conjecture.**\n\nDoes the congruence $(X-1)^n \\equiv X^n - 1 \\pmod{n, X^r-1}$ imply\n$n$ is prime (with a specific exception for $n^2 \\equiv 1 \\pmod{r}$)?\n\nWhile the \"if\" direction is a known theorem, the \"only if\" direction\nremains a conjecture.\n-/\n@[category research open, question, AMS 11]\ntheorem agrawal_conjecture :\n    ∀ (n r : ℕ), n > 1 → r > 0 → n.gcd r = 1 →\n      let R := Polynomial (ZMod n)\n      let X : R := Polynomial.X\n      let I : Ideal R := Ideal.span ({X^r - 1} : Set R)\n      Ideal.Quotient.mk I ((X - 1)^n) = Ideal.Quotient.mk I (X^n - 1) →\n      (n.Prime ∨ (n^2 : ZMod r) = 1) := by\n  sorry\n\n/--\n**Roman B. Popovych Conjecture.**\nA stronger version of Agrawal's conjecture, which also considers the congruence\n$(X+2)^n \\equiv X^n + 2 \\pmod{n, X^r-1}$.\nIf both congruences hold, then $n$ is either prime or $n^2 \\equiv 1 \\pmod{r}$.\nThis variant was proposed by Roman B. Popovych in 2018.\n-/\n@[category research open, AMS 11]\ntheorem agrawal_conjecture.variants.popovych :\n  ∀ (n r : ℕ), n > 1 → r > 0 → n.gcd r = 1 →\n    let R := Polynomial (ZMod n)\n    let X : R := Polynomial.X\n    let I : Ideal R := Ideal.span ({X^r - 1} : Set R)\n    Ideal.Quotient.mk I ((X - 1)^n) = Ideal.Quotient.mk I (X^n - 1) →\n    Ideal.Quotient.mk I ((X + 2)^n) = Ideal.Quotient.mk I (X^n + 2) →\n    (n.Prime ∨ (n^2 : ZMod r) = 1) := by\n  sorry\n\nend AgrawalConjecture\n",
  "statement_hash": "8b18fdc05f72100e31b529621eeb4bffb5832375141fc93090c2e074b8a19b6d",
  "toolchain": "leanprover/lean4:v4.33.1",
  "upstream_commit": "f9b3868d5ca994a7bf95039bcec05338c0c21e2f",
  "workspace": "formal-conjectures",
  "field": "math",
  "formalization": "formal",
  "verification": "lean-kernel",
  "license": "Apache-2.0",
  "attribution": "google-deepmind/formal-conjectures contributors",
  "metric_name": null,
  "metric_direction": null,
  "critiques": [],
  "public_partial_proofs": [],
  "research_threads": [],
  "instructions": "Read research_threads first: other people's public repositories and what they already tried. Write Solution.lean starting from challenge_source. Keep every definition identical, prove decl_name with exactly the same type, no sorry in its dependency closure, no new axioms, no native_decide, no metaprogramming. Submit with POST /api/v1/submissions."
}