|
| 1 | +/- |
| 2 | +Copyright 2026 The Formal Conjectures Authors. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +-/ |
| 16 | + |
| 17 | +import FormalConjectures.Util.ProblemImports |
| 18 | + |
| 19 | +/-! |
| 20 | +# Erdős Problem 1142 |
| 21 | +
|
| 22 | +*References:* |
| 23 | +- [erdosproblems.com/1142](https://www.erdosproblems.com/1142) |
| 24 | +- [A039669](https://oeis.org/A039669) |
| 25 | +- [Va99] Various, Some of Paul's favorite problems. Booklet produced for the conference "Paul Erdős |
| 26 | + and his mathematics", Budapest, July 1999 (1999). |
| 27 | +- [MiWe69] Mientka, W. E. and Weitzenkamp, R. C., On f-plentiful numbers, Journal of |
| 28 | + Combinatorial Theory, Volume 7, Issue 4, December 1969, pages 374-377. |
| 29 | +
|
| 30 | +-/ |
| 31 | + |
| 32 | +open Nat Set |
| 33 | + |
| 34 | +namespace Erdos1142 |
| 35 | + |
| 36 | +/-- |
| 37 | +The property that $n > 2$ and $n - 2^k$ is prime for all $k \geq 1$ with $2^k < n$. |
| 38 | +
|
| 39 | +Following the OEIS [A039669](https://oeis.org/A039669) convention ("Numbers n > 2 such that ..."), |
| 40 | +we require $n > 2$ to exclude the trivial cases $n \leq 2$, for which the primality condition |
| 41 | +is vacuously satisfied. |
| 42 | +-/ |
| 43 | +def Erdos1142Prop (n : ℕ) : Prop := |
| 44 | + 2 < n ∧ ∀ k, 0 < k → 2 ^ k < n → (n - 2 ^ k).Prime |
| 45 | + |
| 46 | +/-- |
| 47 | +Are there infinitely many $n > 2$ such that $n - 2^k$ is prime for all $k \geq 1$ with $2^k < n$? |
| 48 | +
|
| 49 | +The only known such $n$ are $4, 7, 15, 21, 45, 75, 105$ (OEIS [A039669](https://oeis.org/A039669)). |
| 50 | +-/ |
| 51 | +@[category research open, AMS 11] |
| 52 | +theorem erdos_1142 : |
| 53 | + answer(sorry) ↔ Infinite { n | Erdos1142Prop n } := by |
| 54 | + sorry |
| 55 | + |
| 56 | +/-- |
| 57 | +Mientka and Weitzenkamp [MiWe69] proved that the only $n \leq 2^{44}$ such that $n > 2$ and |
| 58 | +$n - 2^k$ is prime for all $k \geq 1$ with $2^k < n$ are $4, 7, 15, 21, 45, 75, 105$. |
| 59 | +-/ |
| 60 | +@[category research solved, AMS 11] |
| 61 | +theorem erdos_1142.variants.mientka_weitzenkamp : |
| 62 | + { n : ℕ | n ≤ 2 ^ 44 ∧ Erdos1142Prop n } = {4, 7, 15, 21, 45, 75, 105} := by |
| 63 | + sorry |
| 64 | +/-- Helper tactic for proving `Erdos1142Prop` for small concrete values. -/ |
| 65 | +local macro "prove_erdos_1142_prop" bound:num : tactic => |
| 66 | + `(tactic| ( |
| 67 | + refine ⟨by omega, fun k hk hlt => ?_⟩ |
| 68 | + have : k ≤ $bound := by |
| 69 | + by_contra h; push_neg at h |
| 70 | + exact absurd (Nat.pow_le_pow_right (by omega : 1 ≤ 2) h) (by omega) |
| 71 | + interval_cases k <;> simp_all (config := { decide := true }))) |
| 72 | + |
| 73 | +/-- $4$ satisfies the Erdős 1142 property: $4 - 2 = 2$ is prime. -/ |
| 74 | +@[category test, AMS 11] |
| 75 | +theorem erdos_1142.test_4 : Erdos1142Prop 4 := by prove_erdos_1142_prop 1 |
| 76 | + |
| 77 | +/-- $7$ satisfies the Erdős 1142 property: $7 - 2 = 5$ and $7 - 4 = 3$ are prime. -/ |
| 78 | +@[category test, AMS 11] |
| 79 | +theorem erdos_1142.test_7 : Erdos1142Prop 7 := by prove_erdos_1142_prop 2 |
| 80 | + |
| 81 | +/-- $15$ satisfies the Erdős 1142 property: $15 - 2 = 13$, $15 - 4 = 11$, $15 - 8 = 7$. -/ |
| 82 | +@[category test, AMS 11] |
| 83 | +theorem erdos_1142.test_15 : Erdos1142Prop 15 := by prove_erdos_1142_prop 3 |
| 84 | + |
| 85 | +/-- $21$ satisfies the Erdős 1142 property: $21 - 2 = 19$, $21 - 4 = 17$, $21 - 8 = 13$, |
| 86 | +$21 - 16 = 5$. -/ |
| 87 | +@[category test, AMS 11] |
| 88 | +theorem erdos_1142.test_21 : Erdos1142Prop 21 := by prove_erdos_1142_prop 4 |
| 89 | + |
| 90 | +/-- $45$ satisfies the Erdős 1142 property: $45 - 2 = 43$, $45 - 4 = 41$, $45 - 8 = 37$, |
| 91 | +$45 - 16 = 29$, $45 - 32 = 13$. -/ |
| 92 | +@[category test, AMS 11] |
| 93 | +theorem erdos_1142.test_45 : Erdos1142Prop 45 := by prove_erdos_1142_prop 5 |
| 94 | + |
| 95 | +/-- $75$ satisfies the Erdős 1142 property: $75 - 2 = 73$, $75 - 4 = 71$, $75 - 8 = 67$, |
| 96 | +$75 - 16 = 59$, $75 - 32 = 43$, $75 - 64 = 11$. -/ |
| 97 | +@[category test, AMS 11] |
| 98 | +theorem erdos_1142.test_75 : Erdos1142Prop 75 := by prove_erdos_1142_prop 6 |
| 99 | + |
| 100 | +/-- $105$ satisfies the Erdős 1142 property: the largest known example. |
| 101 | +$105 - 2 = 103$, $105 - 4 = 101$, $105 - 8 = 97$, $105 - 16 = 89$, $105 - 32 = 73$, |
| 102 | +$105 - 64 = 41$. -/ |
| 103 | +@[category test, AMS 11] |
| 104 | +theorem erdos_1142.test_105 : Erdos1142Prop 105 := by prove_erdos_1142_prop 6 |
| 105 | + |
| 106 | +/-- $106$ does not satisfy the Erdős 1142 property ($106 - 2 = 104 = 8 \times 13$). -/ |
| 107 | +@[category test, AMS 11] |
| 108 | +theorem erdos_1142.test_not_106 : ¬ Erdos1142Prop 106 := by |
| 109 | + intro ⟨_, h⟩ |
| 110 | + have := h 1 (by omega) (by omega) |
| 111 | + revert this; decide |
| 112 | + |
| 113 | +end Erdos1142 |
0 commit comments