{
  "id": "5441",
  "ident": "NS.05441",
  "slug": "oeis-226163",
  "title": "Determinant of Legendre symbol matrix with factorial shifts",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Conjecture: $a(n) = 0$ if and only if $p_n \\equiv 3 \\pmod 4$.\n- _Zhi-Wei Sun_, Aug 13 2013\n\nProved in the OEIS Open project, see T. Adamczewski, OEIS Open: How many conjectures can\nlanguage models turn into theorems?, [arXiv:2608.11941](https://arxiv.org/abs/2608.11941).",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA226163.conjecture",
  "statement_lean": "theorem conjecture (n : ℕ) (hn : 2 ≤ n) :\n    a n = 0 ↔ Nat.nth Nat.Prime (n - 1) % 4 = 3",
  "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# Determinant of Legendre symbol matrix with factorial shifts\n\nDeterminant of the $(p_n-1)/2$-by-$(p_n-1)/2$ matrix with $(i,j)$-entry being the Legendre symbol\n$$\\left(\\frac{i^2 - \\left(\\frac{p_n-1}{2}\\right)! j}{p_n}\\right),$$\nwhere $p_n$ is the $n$-th prime ($n \\ge 2$).\n\n*References:*\n- [A226163](https://oeis.org/A226163)\n- T. Adamczewski, \"OEIS Open: How many conjectures can language models turn into theorems?\",\n  [arXiv:2608.11941](https://arxiv.org/abs/2608.11941) [cs.AI], 2026.\n-/\n\n@[expose] public section\n\nnamespace OeisA226163\n\nopen Matrix\n\n/-- The $(p-1)/2$-by-$(p-1)/2$ matrix with $(i,j)$-entry being the Jacobi symbol\n$\\left(\\frac{i^2 - \\left(\\frac{p-1}{2}\\right)! j}{p}\\right)$ for $1 \\le i, j \\le (p-1)/2$. -/\ndef legendreMatrix (p : ℕ) : Matrix (Fin ((p - 1) / 2)) (Fin ((p - 1) / 2)) ℤ :=\n  let m : ℕ := (p - 1) / 2\n  let C : ℤ := m.factorial\n  fun i j =>\n    let i' : ℤ := i.val + 1\n    let j' : ℤ := j.val + 1\n    jacobiSym (i' * i' - C * j') p\n\n/-- Determinant of `legendreMatrix` for the $n$-th prime $p_n$. -/\nnoncomputable def a (n : ℕ) : ℤ :=\n  (legendreMatrix (Nat.nth Nat.Prime (n - 1))).det\n\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 0 := by\n  have h : Nat.nth Nat.Prime (2 - 1) = 3 := Nat.nth_prime_one_eq_three\n  rw [a, h, det_fin_one]\n  norm_num [legendreMatrix]\n\n@[category test, AMS 11]\ntheorem a_3 : a 3 = -1 := by\n  have h : Nat.nth Nat.Prime (3 - 1) = 5 := Nat.nth_prime_two_eq_five\n  rw [a, h, det_fin_two]\n  norm_num [legendreMatrix]\n\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 0 := by\n  have h : Nat.nth Nat.Prime (4 - 1) = 7 := Nat.nth_prime_three_eq_seven\n  have hM : legendreMatrix 7 =\n      !![1, -1, 1;\n         -1, -1, 0;\n         -1, 1, -1] := by\n    ext i j\n    fin_cases i <;> fin_cases j <;> simp [legendreMatrix] <;> norm_num\n  rw [a, h, hM]\n  eval_det\n\n@[category test, AMS 11]\ntheorem a_5 : a 5 = 0 := by\n  have h : Nat.nth Nat.Prime (5 - 1) = 11 := Nat.nth_prime_four_eq_eleven\n  have hM : legendreMatrix 11 =\n      !![-1, 1, 1, 1, -1;\n         1, -1, -1, -1, 1;\n         -1, 0, 1, -1, 1;\n         -1, -1, -1, 1, -1;\n         1, 1, -1, -1, -1] := by\n    ext i j\n    fin_cases i <;> fin_cases j <;> simp [legendreMatrix] <;> norm_num\n  rw [a, h, hM]\n  eval_det\n\n@[category test, AMS 11]\ntheorem a_6 : a 6 = -8 := by\n  have h : Nat.nth Nat.Prime (6 - 1) = 13 := Nat.nth_prime_five_eq_thirteen\n  have hM : legendreMatrix 13 =\n      !![1, 1, 1, -1, -1, 1;\n         1, -1, -1, 1, -1, 0;\n         1, 1, -1, -1, 1, -1;\n         -1, -1, 1, 1, 1, 1;\n         -1, -1, 1, -1, 0, -1;\n         -1, 0, -1, 1, -1, -1] := by\n    ext i j\n    fin_cases i <;> fin_cases j <;> simp [legendreMatrix] <;> norm_num\n  rw [a, h, hM]\n  eval_det\n\n/--\nConjecture: $a(n) = 0$ if and only if $p_n \\equiv 3 \\pmod 4$.\n- _Zhi-Wei Sun_, Aug 13 2013\n\nProved in the OEIS Open project, see T. Adamczewski, OEIS Open: How many conjectures can\nlanguage models turn into theorems?, [arXiv:2608.11941](https://arxiv.org/abs/2608.11941).\n-/\n@[category research solved, AMS 11]\ntheorem conjecture (n : ℕ) (hn : 2 ≤ n) :\n    a n = 0 ↔ Nat.nth Nat.Prime (n - 1) % 4 = 3 := by\n  sorry\n\nend OeisA226163\n",
  "statement_hash": "baddcf9686c389c7bf5d55e6ac4f1ede2bd7fe1a40a26846444f4ae6c6aafbf4",
  "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."
}