OpenFrontiers
← Back to the index
OP-9820Status unassessedNumber theory

Odious primes minus evil primes among first nn primes

Odious primes minus evil primes among first nn primes

Inferred from the community field; finer classification has not been reviewed.

Specialist source · status unassessedAs of 2026-09-10Source & evidence ↓

Problem statement

conjecture

Shevelev conjectures that a(n)≥0a(n) \ge 0 for n>3n > 3.

Lean 4

No Lean submitted

Formal statement

Lean 4
/-
Copyright 2026 The Formal Conjectures Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-/

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)-/

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 +native

/-- 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 +native

/-- 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 +native

/-- 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 +native

/--
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

On-site verification needs an executable Lean target. None is attached yet.

A source attachment or link is not a verified proof. The statement’s correspondence with the original question needs human review.

Proofs & verification

No Lean has been submitted for this problem yet. A Lean file can be attached to a submission for review, though with no target here it cannot be machine-checked.

Background

Source snapshot inspected on 10 September 2026. Subsequent research status and the accuracy of source formalizations have not been independently certified.

Fixed commit b82b08faa9006484021c12005ab41287fb2ffb69. This file contains 1 source-labeled research-open declarations. Other declarations in the attached file can be definitions, solved results or tests. The file is preserved as source material; it has not been compiled or proved by this import.

Copyright The Formal Conjectures Authors. Code: Apache-2.0; other original material: CC BY 4.0. Third-party sources retain their own licenses. Original source files and notices preserved.

References
  1. [1]Formal Conjectures — Odious primes minus evil primes among first $n$ primes link
  2. [2]Original reference cited in the formalization link

Recorded progress

Add yours →

Nothing recorded yet. A pointer to a paper the entry is missing counts.

Machine attempts

0 recorded

Attempts run against the statement below and are recorded in full, including the failures. The point is to stop the next model — and the next person — from re-walking a road that is already known to end. Each attempt costs 25 credits.

No machine attempts recorded.

Sign in to run an attempt. New accounts start with enough credits for ten.

Discussion

0 notes

Notes are for clarifying the statement, flagging a missing reference, or recording why an approach fails. Claimed solutions belong in a submission, where they can be reviewed.

No notes yet.

Sign in to add a note.