/- 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. -/ module public import FormalConjecturesUtil

Number of primes of the form $2^n \pm 2^k \pm 1$ with $0 \le k < n$

The sequence $a(n)$ counts the number of distinct primes of the form $2^n \pm 2^k \pm 1$ for $0 \le k < n$.

References:

@[expose] public sectionnamespace OeisA196697

Number of distinct primes of the form $2^n \pm 2^k \pm 1$ with $0 \le k < n$.

def a (n : ℕ) : ℕ := let candidates : Finset ℕ := (Finset.range n).biUnion fun k => {2 ^ n + 2 ^ k + 1, 2 ^ n + 2 ^ k - 1, 2 ^ n - 2 ^ k + 1, 2 ^ n - 2 ^ k - 1} (candidates.filter Nat.Prime).card@[category test, AMS 11] theorem a_1 : a 1 = 1 := ⊢ a 1 = 1 All goals completed! 🐙@[category test, AMS 11] theorem a_2 : a 2 = 4 := ⊢ a 2 = 4 All goals completed! 🐙@[category test, AMS 11] theorem a_3 : a 3 = 5 := ⊢ a 3 = 5 All goals completed! 🐙@[category test, AMS 11] theorem a_4 : a 4 = 6 := ⊢ a 4 = 6 All goals completed! 🐙@[category test, AMS 11] theorem a_5 : a 5 = 7 := ⊢ a 5 = 7 All goals completed! 🐙

Conjecture: all terms of this sequence are greater than $0$.

    Lei Zhou, Oct 05 2011

@[category research open, AMS 11] theorem conjecture_1 (n : ℕ) (hn : 1 ≤ n) : 0 < a n := n:ℕhn:1 ≤ n⊢ 0 < a n All goals completed! 🐙

Conjecture: infinitely many elements of this sequence are equal to $0$.

    Charles R Greathouse IV, Nov 21 2011

@[category research open, AMS 11] theorem conjecture_2 : Set.Infinite {n : ℕ | a n = 0} := ⊢ {n | a n = 0}.Infinite All goals completed! 🐙end OeisA196697