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

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Odious primes minus evil primes among first nn primes · a_4

Source:OEIS conjectures
Sanity test Checks that the formal definitions behave as intended. First verified proof: +1 points.
Statement:reviewed
Statement:

Value of the sequence a at 4.

Subjects:Number Theory (math.NT)
MSC classes:11
Cite as:NS.04921 [math.NT] · NS.04921v1 for this version
Declaration:OeisA130911.a_4
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 1; accepted critique: up to 100
Statement hash:f8b4c44cc63f60b0f064333cf44f96c8ed3a7a7c389b4d0747906bcac63f85a5
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/OEIS/130911.lean

Formal statement

theorem a_4 : a 4 = 0
Show the full Challenge.lean (102 lines) — definitions included
module

public import FormalConjecturesUtil


/-!
# Odious primes minus evil primes among first $n$ primes

$a(n)$ is the number of primes with odd binary weight (odious primes) among the first $n$ primes
minus the number with even binary weight (evil primes).

*References:*
- [A130911](https://oeis.org/A130911)-/

@[expose] public section

namespace OeisA130911

/-- Parity sign of binary weight: $+1$ if popcount is odd, $-1$ if even. -/
def signWeight (k : ℕ) : ℤ :=
  if (Nat.digits 2 k).sum % 2 = 1 then 1 else -1

/-- $a(n) = \sum_{i=0}^{n-1} \mathrm{signWeight}(p_i)$ where $p_i$ is the $i$-th prime. -/
noncomputable def a (n : ℕ) : ℤ :=
  ∑ i ∈ Finset.range n, signWeight (Nat.nth Nat.Prime i)

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

/-- Value of the sequence `a` at 1. -/
@[category test, AMS 11]
theorem a_1 : a 1 = 1 := by
  unfold a
  have h : Finset.range 1 = {0} := by decide
  rw [h, Finset.sum_singleton]
  have h0 : Nat.nth Nat.Prime 0 = 2 := Nat.nth_prime_zero_eq_two
  rw [h0]
  decide

/-- Value of the sequence `a` at 2. -/
@[category test, AMS 11]
theorem a_2 : a 2 = 0 := by
  unfold a
  have h : Finset.range 2 = {0, 1} := by decide
  rw [h, Finset.sum_pair (by decide)]
  have h0 : Nat.nth Nat.Prime 0 = 2 := Nat.nth_prime_zero_eq_two
  have h1 : Nat.nth Nat.Prime 1 = 3 := Nat.nth_prime_one_eq_three
  rw [h0, h1]
  decide

/-- Value of the sequence `a` at 3. -/
@[category test, AMS 11]
theorem a_3 : a 3 = -1 := by
  unfold a
  have h : Finset.range 3 = {0, 1, 2} := by decide
  rw [h]
  have h0 : Nat.nth Nat.Prime 0 = 2 := Nat.nth_prime_zero_eq_two
  have h1 : Nat.nth Nat.Prime 1 = 3 := Nat.nth_prime_one_eq_three
  have h2 : Nat.nth Nat.Prime 2 = 5 := Nat.nth_prime_two_eq_five
  rw [Finset.sum_insert (by decide), Finset.sum_pair (by decide)]
  rw [h0, h1, h2]
  decide

/-- Value of the sequence `a` at 4. -/
@[category test, AMS 11]
theorem a_4 : a 4 = 0 := by
  unfold a
  have h : Finset.range 4 = {0, 1, 2, 3} := by decide
  rw [h]
  have h0 : Nat.nth Nat.Prime 0 = 2 := Nat.nth_prime_zero_eq_two
  have h1 : Nat.nth Nat.Prime 1 = 3 := Nat.nth_prime_one_eq_three
  have h2 : Nat.nth Nat.Prime 2 = 5 := Nat.nth_prime_two_eq_five
  have h3 : Nat.nth Nat.Prime 3 = 7 := Nat.nth_prime_three_eq_seven
  rw [Finset.sum_insert (by decide), Finset.sum_insert (by decide),
    Finset.sum_pair (by decide)]
  rw [h0, h1, h2, h3]
  decide

/--
Shevelev conjectures that $a(n) \ge 0$ for $n > 3$.-/
@[category research open, AMS 11]
theorem conjecture (n : ℕ) (hn : 3 < n) : a n ≥ 0 := by
  sorry

end OeisA130911

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

nosorry desk oeis-130911--a-4      # a desk lease: required before submitting (renew: nosorry beat)
nosorry fetch oeis-130911--a-4
nosorry submit oeis-130911--a-4 nosorry/oeis-130911--a-4/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.