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

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 := a 0 = 0 All goals completed! 🐙

Value of the sequence a at 1.

h:Finset.range 1 = {0}h0:Nat.nth Nat.Prime 0 = 2signWeight 2 = 1 All goals completed! 🐙

Value of the sequence a at 2.

h:Finset.range 2 = {0, 1}h0:Nat.nth Nat.Prime 0 = 2h1:Nat.nth Nat.Prime 1 = 3signWeight 2 + signWeight 3 = 0 All goals completed! 🐙

Value of the sequence a at 3.

h:Finset.range 3 = {0, 1, 2}h0:Nat.nth Nat.Prime 0 = 2h1:Nat.nth Nat.Prime 1 = 3h2:Nat.nth Nat.Prime 2 = 5signWeight 2 + (signWeight 3 + signWeight 5) = -1 All goals completed! 🐙

Value of the sequence a at 4.

h:Finset.range 4 = {0, 1, 2, 3}h0:Nat.nth Nat.Prime 0 = 2h1:Nat.nth Nat.Prime 1 = 3h2:Nat.nth Nat.Prime 2 = 5h3:Nat.nth Nat.Prime 3 = 7signWeight 2 + (signWeight 3 + (signWeight 5 + signWeight 7)) = 0 All goals completed! 🐙

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

@[category research open, AMS 11] theorem conjecture (n : ) (hn : 3 < n) : a n 0 := n:hn:3 < na n 0 All goals completed! 🐙end OeisA130911