/-
Copyright 2025 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 FormalConjecturesUtilErdős Problem 10
References:
[Cr71] Crocker, R., On the sum of a prime and of two powers of two. Pacific J. Math. 36 (1971), 103-107.
@[expose] public sectionnamespace Erdos10The set of natural numbers that can be written as a sum of a prime and at most $k$ powers of $2$.
abbrev sumPrimeAndTwoPows (k : ℕ) : Set ℕ :=
{ p + (pows.map (2 ^ ·)).sum | (p : ℕ) (pows : Multiset ℕ) (_ : p.Prime)
(_ : pows.card ≤ k)}Is there some $k$ such that every integer is the sum of a prime and at most $k$ powers of $2$?
@[category research open, AMS 5 11]
theorem erdos_10 : answer(sorry) ↔ ∃ k, sumPrimeAndTwoPows k = Set.univ \ {0, 1} := ⊢ True ↔ ∃ k, sumPrimeAndTwoPows k = Set.univ \ {0, 1}
All goals completed! 🐙Gallagher [Ga75] has shown that for any $ϵ > 0$ there exists $k(ϵ)$ such that the set of integers which are the sum of a prime and at most $k(ϵ)$ many powers of $2$ has lower density at least $1 - ϵ$.
Ref: Gallagher, P. X., Primes and powers of 2.
@[category research solved, AMS 5 11]
theorem erdos_10.variants.gallagher (ε : ℝ)
(hε : 0 < ε) : ∃ k, 1 - ε ≤ (sumPrimeAndTwoPows k).lowerDensity := ε:ℝhε:0 < ε⊢ ∃ k, 1 - ε ≤ (sumPrimeAndTwoPows k).lowerDensity
All goals completed! 🐙Granville and Soundararajan [GrSo98] have conjectured that at most $3$ powers of $2$ suffice for all odd integers, and hence at most $4$ powers of $2$ suffice for all even integers.
Ref: Granville, A. and Soundararajan, K., A Binary Additive Problem of Erdős and the Order of $2$ mod $p^2$
@[category research open, AMS 5 11]
theorem erdos_10.variants.granville_soundararajan_odd :
{n : ℕ | Odd n ∧ 1 < n} ⊆ sumPrimeAndTwoPows 3 ∧
{n : ℕ | Even n ∧ n ≠ 0} ⊆ sumPrimeAndTwoPows 4 := ⊢ {n | Odd n ∧ 1 < n} ⊆ sumPrimeAndTwoPows 3 ∧ {n | Even n ∧ n ≠ 0} ⊆ sumPrimeAndTwoPows 4
All goals completed! 🐙
Bogdan Grechuk has observed that 1117175146 is not the sum of a prime
and at most $3$ powers of $2$.
@[category research solved, AMS 5 11]
theorem erdos_10.variants.grechuk_example :
1117175146 ∉ sumPrimeAndTwoPows 3 := ⊢ 1117175146 ∉ sumPrimeAndTwoPows 3
All goals completed! 🐙There are infinitely many even integers not the sum of a prime and $2$ powers of $2$
@[category research solved, AMS 5 11]
theorem erdos_10.variants.two_pows :
Set.Infinite <| {n : ℕ | Even n} \ sumPrimeAndTwoPows 2 := ⊢ ({n | Even n} \ sumPrimeAndTwoPows 2).Infinite
All goals completed! 🐙Bogdan Grechuk has observed that $1117175146$ is not the sum of a prime and at most $3$ powers of $2$, and pointed out that parity considerations, coupled with the fact that there are many integers not the sum of a prime and $2$ powers of $2$ suggest that there exist infinitely many even integers which are not the sum of a prime and at most $3$ powers of $2$.
This follows from Crocker's construction [Cr71] of infinitely many odd $t \equiv 15 \pmod{16}$ which are not the sum of a prime and $2$ powers of $2$: each such $t + 1$ is even and not the sum of a prime and at most $3$ powers of $2$.
The linked Lean formalisation is by Daryxx, see comment section.
@[category research solved, AMS 5 11, formal_proof using lean4 at
"https://gist.github.com/DaryxXx/e112c74cc648b08a420b0959315cf65f/4b347897ff1811f1db1d82594c581f54b8f31b7d#file-main-lean-L2287"]
theorem erdos_10.variants.grechuk :
Set.Infinite <| {n : ℕ | Even n} \ sumPrimeAndTwoPows 3 := ⊢ ({n | Even n} \ sumPrimeAndTwoPows 3).Infinite
All goals completed! 🐙end Erdos10