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

Least $m > 0$ such that ${2^k - k : k = 1, \dots, m}$ covers all residues modulo $n$

For $n \ge 1$, $a(n)$ is the least positive integer $m$ such that ${2^k - k : k = 1, \dots, m}$ contains a complete system of residues modulo $n$.

References:

    A232616

    T. Adamczewski, "OEIS Open: How many conjectures can language models turn into theorems?", arXiv:2608.11941 [cs.AI], 2026.

@[expose] public sectionnamespace OeisA232616

The predicate that ${2^k - k : k = 1, \dots, m}$ contains a complete system of residues modulo $n$.

def HasCompleteResidueSystem (n m : ℕ) [NeZero n] : Prop := (Finset.univ : Finset (ZMod n)) = (Finset.Icc 1 m).image fun k ↦ (Nat.cast (2 ^ k - k) : ZMod n)instance (n m : ℕ) [NeZero n] : Decidable (HasCompleteResidueSystem n m) := decEq _ _

Least positive integer $m$ such that ${2^k - k : k = 1, \dots, m}$ contains a complete system of residues modulo $n$.

noncomputable def a (n : ℕ) : ℕ := if h : n = 0 then 0 else have : NeZero n := NeZero.mk h sInf { m : ℕ | HasCompleteResidueSystem n m }⊢ (have this := ⋯; sInf {m | HasCompleteResidueSystem 1 m}) = 1 exact IsLeast.csInf_eq (⊢ IsLeast {m | HasCompleteResidueSystem 1 m} 1 All goals completed! 🐙)⊢ (have this := ⋯; sInf {m | HasCompleteResidueSystem 2 m}) = 2 exact IsLeast.csInf_eq (⊢ IsLeast {m | HasCompleteResidueSystem 2 m} 2 All goals completed! 🐙)⊢ (have this := ⋯; sInf {m | HasCompleteResidueSystem 3 m}) = 4 exact IsLeast.csInf_eq (⊢ IsLeast {m | HasCompleteResidueSystem 3 m} 4 All goals completed! 🐙)⊢ (have this := ⋯; sInf {m | HasCompleteResidueSystem 4 m}) = 5 exact IsLeast.csInf_eq (⊢ IsLeast {m | HasCompleteResidueSystem 4 m} 5 All goals completed! 🐙)⊢ (have this := ⋯; sInf {m | HasCompleteResidueSystem 5 m}) = 10 exact IsLeast.csInf_eq (⊢ IsLeast {m | HasCompleteResidueSystem 5 m} 10 All goals completed! 🐙)

Conjecture (i): $a(n) < 2 \cdot (\text{prime}(n) - 1)$ for all $n > 0$, where $\text{prime}(n)$ is the $n$-th prime number (1-indexed).

Disproved for $n = 550172$ in the OEIS Open project, see T. Adamczewski, OEIS Open: How many conjectures can language models turn into theorems?, arXiv:2608.11941.

@[category research solved, AMS 11] theorem conjecture_1 : ¬ ∀ n > 0, a n < 2 * (Nat.nth Nat.Prime (n - 1) - 1) := ⊢ ¬∀ n > 0, OeisA232616.a n < 2 * (Nat.nth Nat.Prime (n - 1) - 1) All goals completed! 🐙

Conjecture (ii), first equation: The Diophantine equation $x^n - n = y^m$ with $m, n, x, y > 1$ only has two integral solutions: $2^5 - 5 = 3^3$ and $2^7 - 7 = 11^2$.

@[category research open, AMS 11] theorem conjecture_2 (x y n m : ℕ) (hx : 1 < x) (hy : 1 < y) (hn : 1 < n) (hm : 1 < m) : x ^ n - n = y ^ m ↔ (x = 2 ∧ n = 5 ∧ y = 3 ∧ m = 3) ∨ (x = 2 ∧ n = 7 ∧ y = 11 ∧ m = 2) := x:ℕy:ℕn:ℕm:ℕhx:1 < xhy:1 < yhn:1 < nhm:1 < m⊢ x ^ n - n = y ^ m ↔ x = 2 ∧ n = 5 ∧ y = 3 ∧ m = 3 ∨ x = 2 ∧ n = 7 ∧ y = 11 ∧ m = 2 All goals completed! 🐙

Conjecture (ii), second equation: The Diophantine equation $x^n + n = y^m$ with $m, n, x, y > 1$ only has two integral solutions: $5^2 + 2 = 3^3$ and $5^3 + 3 = 2^7$.

@[category research open, AMS 11] theorem conjecture_3 (x y n m : ℕ) (hx : 1 < x) (hy : 1 < y) (hn : 1 < n) (hm : 1 < m) : x ^ n + n = y ^ m ↔ (x = 5 ∧ n = 2 ∧ y = 3 ∧ m = 3) ∨ (x = 5 ∧ n = 3 ∧ y = 2 ∧ m = 7) := x:ℕy:ℕn:ℕm:ℕhx:1 < xhy:1 < yhn:1 < nhm:1 < m⊢ x ^ n + n = y ^ m ↔ x = 5 ∧ n = 2 ∧ y = 3 ∧ m = 3 ∨ x = 5 ∧ n = 3 ∧ y = 2 ∧ m = 7 All goals completed! 🐙end OeisA232616