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

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Number of times n2+s2n^2 + s^2 is prime for positive integers s<ns < n

Source:OEIS conjectures
Open problem Nobody knows the answer yet — neither on paper nor in Lean. First verified proof: +100 points.
Statement:reviewed
Statement:

Conjecture: a(n)>0a(n) > 0 for all n>1n > 1.

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

Formal statement

theorem conjecture1 (n : ℕ) (hn : 1 < n) : 0 < a n
Show the full Challenge.lean (126 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Number of times $n^2 + s^2$ is prime for positive integers $s < n$

The sequence $a(n)$ counts the number of integers $s \in \{1, \dots, n-1\}$ such that
$n^2 + s^2$ is prime:
$$a(n) = \sum_{s=1}^{n-1} [\text{Prime}(n^2 + s^2)]$$

*References:*
- [A069004](https://oeis.org/A069004)
- [CE26] j2d9w5xtjn-png, [Counterexample to the upper bound](https://github.com/google-deepmind/formal-conjectures/pull/5453), 2026.
- [Li26] Wentao Li, [Lean certificate for the A069004 counterexample](https://github.com/VictorLiwentao/lean-oeis-proofs/blob/a16a2711b082ccab4ba941330148e7b7c78b11c1/proofs/new-formalization/A069004/PROOF.md), 2026.
-/

@[expose] public section

namespace OeisA69004

open Finset

/-- Number of times $n^2 + s^2$ is prime for positive integers $s < n$. -/
def a (n : ℕ) : ℕ :=
  ∑ s ∈ Ico 1 n, if (n ^ 2 + s ^ 2).Prime then 1 else 0

/-- Value of the sequence `a` at 1. -/
@[category test, AMS 11]
theorem a_1 : a 1 = 0 := by
  decide

/-- Value of the sequence `a` at 2. -/
@[category test, AMS 11]
theorem a_2 : a 2 = 1 := by
  decide

/-- Value of the sequence `a` at 3. -/
@[category test, AMS 11]
theorem a_3 : a 3 = 1 := by
  decide

/-- Value of the sequence `a` at 4. -/
@[category test, AMS 11]
theorem a_4 : a 4 = 1 := by
  decide

/-- Value of the sequence `a` at 5. -/
@[category test, AMS 11]
theorem a_5 : a 5 = 2 := by
  decide

/--
Conjecture: $a(n) > 0$ for all $n > 1$.-/
@[category research open, AMS 11]
theorem conjecture1 (n : ℕ) (hn : 1 < n) : 0 < a n := by
  sorry

set_option linter.style.formal_proof_palomar false in
/--
Stronger conjecture: Let pi(n) be the prime counting function (A000720). Then
pi(n) >= a(n) >= pi(n)/5 for n>1, with the following equalities: pi(2)=a(2),
pi(10)=a(10) and a(12)=pi(12)/5.
- T. D. Noe, Feb 26 2007

This conjunction is false. The upper bound fails at $n = 512720$:
a Lean certificate proves $a(512720) \ge 42494 > 42493 = \pi(512720)$.
The counterexample was recorded by j2d9w5xtjn-png [CE26].

Lean formalization by Wentao Li, with AI assistance, adapting Epoch Research's
certificate attempt; see [Li26].
-/
@[category research solved, AMS 11,
  formal_proof using lean4 at "https://github.com/VictorLiwentao/lean-oeis-proofs/blob/a16a2711b082ccab4ba941330148e7b7c78b11c1/LeanOeisProofs/NewFormalization/A069004.lean#L58"]
theorem conjecture2 : ¬ (
    (∀ n : ℕ, 1 < n → Nat.primeCounting n ≥ a n) ∧
    (∀ n : ℕ, 1 < n → 5 * a n ≥ Nat.primeCounting n) ∧
    Nat.primeCounting 2 = a 2 ∧
    Nat.primeCounting 10 = a 10 ∧
    5 * a 12 = Nat.primeCounting 12) := by
  sorry

set_option linter.style.formal_proof_palomar false in
/--
The upper bound from T. D. Noe's stronger conjecture: "pi(n) >= a(n)" for "n>1".
It is false at $n = 512720$: $a(512720) \ge 42494 > 42493 = \pi(512720)$.
The counterexample was recorded by j2d9w5xtjn-png [CE26].

Lean formalization by Wentao Li, with AI assistance, adapting Epoch Research's
certificate attempt; see [Li26].
-/
@[category research solved, AMS 11,
  formal_proof using lean4 at "https://github.com/VictorLiwentao/lean-oeis-proofs/blob/a16a2711b082ccab4ba941330148e7b7c78b11c1/LeanOeisProofs/NewFormalization/A069004.lean#L49"]
theorem conjecture2.variants.upper_bound_false :
    ¬ ∀ n : ℕ, 1 < n → Nat.primeCounting n ≥ a n := by
  sorry

/--
The part of the stronger conjecture that survives the counterexample to its upper bound:
$5 a(n) \ge \pi(n)$ for $n > 1$, together with the three claimed equalities
$\pi(2) = a(2)$, $\pi(10) = a(10)$ and $a(12) = \pi(12)/5$.-/
@[category research open, AMS 11]
theorem conjecture2.variants.without_upper_bound :
    (∀ n : ℕ, 1 < n → 5 * a n ≥ Nat.primeCounting n) ∧
    Nat.primeCounting 2 = a 2 ∧
    Nat.primeCounting 10 = a 10 ∧
    5 * a 12 = Nat.primeCounting 12 := by
  sorry

end OeisA69004

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

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

Formal variants

Other formal statements attached to the same informal problem (weaker, stronger, special cases). Each is scored separately.

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.