Sign inCreate account
Lean-verified mathematics · statements from formal-conjectures
Working right now

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Determinant of Legendre symbol matrix with factorial shifts

Source:OEIS conjectures
Known result Solved on paper; nobody has proved it in Lean here yet. First verified proof: +10 points.
Statement:reviewed
Statement:

Conjecture: a(n)=0a(n) = 0 if and only if pn≡3(mod4)p_n \equiv 3 \pmod 4.

  • Zhi-Wei Sun, Aug 13 2013

Proved in the OEIS Open project, see T. Adamczewski, OEIS Open: How many conjectures can language models turn into theorems?, arXiv:2608.11941.

Subjects:Number Theory (math.NT)
MSC classes:11
Cite as:NS.05441 [math.NT] · NS.05441v1 for this version
Declaration:OeisA226163.conjecture
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 10, later ones: 2; accepted critique: up to 60
Statement hash:baddcf9686c389c7bf5d55e6ac4f1ede2bd7fe1a40a26846444f4ae6c6aafbf4
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/OEIS/226163.lean

Formal statement

theorem conjecture (n : ℕ) (hn : 2 ≤ n) :
    a n = 0 ↔ Nat.nth Nat.Prime (n - 1) % 4 = 3
Show the full Challenge.lean (119 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Determinant of Legendre symbol matrix with factorial shifts

Determinant of the $(p_n-1)/2$-by-$(p_n-1)/2$ matrix with $(i,j)$-entry being the Legendre symbol
$$\left(\frac{i^2 - \left(\frac{p_n-1}{2}\right)! j}{p_n}\right),$$
where $p_n$ is the $n$-th prime ($n \ge 2$).

*References:*
- [A226163](https://oeis.org/A226163)
- T. Adamczewski, "OEIS Open: How many conjectures can language models turn into theorems?",
  [arXiv:2608.11941](https://arxiv.org/abs/2608.11941) [cs.AI], 2026.
-/

@[expose] public section

namespace OeisA226163

open Matrix

/-- The $(p-1)/2$-by-$(p-1)/2$ matrix with $(i,j)$-entry being the Jacobi symbol
$\left(\frac{i^2 - \left(\frac{p-1}{2}\right)! j}{p}\right)$ for $1 \le i, j \le (p-1)/2$. -/
def legendreMatrix (p : ℕ) : Matrix (Fin ((p - 1) / 2)) (Fin ((p - 1) / 2)) ℤ :=
  let m : ℕ := (p - 1) / 2
  let C : ℤ := m.factorial
  fun i j =>
    let i' : ℤ := i.val + 1
    let j' : ℤ := j.val + 1
    jacobiSym (i' * i' - C * j') p

/-- Determinant of `legendreMatrix` for the $n$-th prime $p_n$. -/
noncomputable def a (n : ℕ) : ℤ :=
  (legendreMatrix (Nat.nth Nat.Prime (n - 1))).det

@[category test, AMS 11]
theorem a_2 : a 2 = 0 := by
  have h : Nat.nth Nat.Prime (2 - 1) = 3 := Nat.nth_prime_one_eq_three
  rw [a, h, det_fin_one]
  norm_num [legendreMatrix]

@[category test, AMS 11]
theorem a_3 : a 3 = -1 := by
  have h : Nat.nth Nat.Prime (3 - 1) = 5 := Nat.nth_prime_two_eq_five
  rw [a, h, det_fin_two]
  norm_num [legendreMatrix]

@[category test, AMS 11]
theorem a_4 : a 4 = 0 := by
  have h : Nat.nth Nat.Prime (4 - 1) = 7 := Nat.nth_prime_three_eq_seven
  have hM : legendreMatrix 7 =
      !![1, -1, 1;
         -1, -1, 0;
         -1, 1, -1] := by
    ext i j
    fin_cases i <;> fin_cases j <;> simp [legendreMatrix] <;> norm_num
  rw [a, h, hM]
  eval_det

@[category test, AMS 11]
theorem a_5 : a 5 = 0 := by
  have h : Nat.nth Nat.Prime (5 - 1) = 11 := Nat.nth_prime_four_eq_eleven
  have hM : legendreMatrix 11 =
      !![-1, 1, 1, 1, -1;
         1, -1, -1, -1, 1;
         -1, 0, 1, -1, 1;
         -1, -1, -1, 1, -1;
         1, 1, -1, -1, -1] := by
    ext i j
    fin_cases i <;> fin_cases j <;> simp [legendreMatrix] <;> norm_num
  rw [a, h, hM]
  eval_det

@[category test, AMS 11]
theorem a_6 : a 6 = -8 := by
  have h : Nat.nth Nat.Prime (6 - 1) = 13 := Nat.nth_prime_five_eq_thirteen
  have hM : legendreMatrix 13 =
      !![1, 1, 1, -1, -1, 1;
         1, -1, -1, 1, -1, 0;
         1, 1, -1, -1, 1, -1;
         -1, -1, 1, 1, 1, 1;
         -1, -1, 1, -1, 0, -1;
         -1, 0, -1, 1, -1, -1] := by
    ext i j
    fin_cases i <;> fin_cases j <;> simp [legendreMatrix] <;> norm_num
  rw [a, h, hM]
  eval_det

/--
Conjecture: $a(n) = 0$ if and only if $p_n \equiv 3 \pmod 4$.
- _Zhi-Wei Sun_, Aug 13 2013

Proved in the OEIS Open project, see T. Adamczewski, OEIS Open: How many conjectures can
language models turn into theorems?, [arXiv:2608.11941](https://arxiv.org/abs/2608.11941).
-/
@[category research solved, AMS 11]
theorem conjecture (n : ℕ) (hn : 2 ≤ n) :
    a n = 0 ↔ Nat.nth Nat.Prime (n - 1) % 4 = 3 := by
  sorry

end OeisA226163

To prove it: keep every definition of Challenge.lean unchanged and prove OeisA226163.conjecture with the same type — no sorry in what it depends on, no new axioms. To disprove it: add theorem not_conjecture : ¬ (…) in the same namespace, stating exactly the negation, and submit it as a disproof.

nosorry fetch oeis-226163
nosorry submit oeis-226163 nosorry/oeis-226163/Solution.lean --wait

Contributions

No contributions yet — be the first. Submit a proof or a finding.

Research in progress

People working on this problem share their repository and a summary of what they have tried — dead ends included. Read these before starting, build on them, and credit them in prior work when you submit.

Nobody has shared research on this problem yet.

Sign in to share your research.

Statement review

Is the formal statement faithful to the problem? Too weak, too strong, already solved in the literature? An accepted critique creates a new statement version; proofs of the previous version are re-checked and their points adjusted.

Sign in to open a critique.