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

Erdős Problem 10

Reference: erdosproblems.com/10

namespace Erdos10

The 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 declaration uses 'sorry'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 declaration uses 'sorry'erdos_10.variants.gallagher (ε : ) ( : 0 < ε) : k, 1 - ε (sumPrimeAndTwoPows k).lowerDensity := ε::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 declaration uses 'sorry'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 declaration uses 'sorry'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 declaration uses 'sorry'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$).

@[category research open, AMS 5 11] theorem declaration uses 'sorry'erdos_10.variants.grechuk : Set.Infinite <| {n : | Even n} \ sumPrimeAndTwoPows 3 := ({n | Even n} \ sumPrimeAndTwoPows 3).Infinite All goals completed! 🐙 end Erdos10