Repintegers, repstrings, Sierpiński and Riesel numbers, covering method
DefinitionBispelsEtAl2026_DefsDefinitions of Bispels et al. (2026).
- is composite if and is not prime.
- A Sierpiński number is an odd with composite for all ; a Riesel number is an odd with composite for all .
- ; the -repinteger is and the -repstring is .
- A list of congruences is a covering system if every integer satisfies one of them.
- The covering system method for Sierpiński (Riesel) numbers: a covering system, distinct primes with , and () for every .
Formalization Note Division and subtraction are on natural numbers; for the divisions are exact.
import Mathlib.Data.Nat.Prime.Defs
import Mathlib.Algebra.Ring.Parity
import Mathlib.Data.Nat.Log
import Mathlib.Data.Int.ModEq
import Mathlib.Data.List.Nodup
namespace BispelsEtAl2026
/-- `N` is composite: `N > 1` and `N` is not prime. -/
def IsComposite (N : ℕ) : Prop := 1 < N ∧ ¬ N.Prime
/-- A Sierpiński number: an odd `k` such that `k·2^n + 1` is composite for every positive `n`. -/
def IsSierpinski (k : ℕ) : Prop := Odd k ∧ ∀ n : ℕ, 0 < n → IsComposite (k * 2 ^ n + 1)
/-- A Riesel number: an odd `k` such that `k·2^n − 1` is composite for every positive `n`. -/
def IsRiesel (k : ℕ) : Prop := Odd k ∧ ∀ n : ℕ, 0 < n → IsComposite (k * 2 ^ n - 1)
/-- The number of base-`b` digits of `k`: `ℓ = ⌊log_b k⌋ + 1`. -/
def digitLength (b k : ℕ) : ℕ := Nat.log b k + 1
/-- The `b`-repinteger `k_b^{(t)} = k (b^{ℓ t} − 1)/(b^ℓ − 1)` with `ℓ = ⌊log_b k⌋ + 1`:
`k` written `t` times in base `b`. When `k < b` it is the `b`-repdigit with digit `k`. -/
def repinteger (b k t : ℕ) : ℕ :=
k * ((b ^ (digitLength b k * t) - 1) / (b ^ digitLength b k - 1))
/-- The `b`-repstring `k_b^{(z;t)} = k (b^{(z+ℓ) t} − 1)/(b^{z+ℓ} − 1)`: `k` written `t` times in
base `b`, with `z` zeros inserted between consecutive copies. -/
def repstring (b k z t : ℕ) : ℕ :=
k * ((b ^ ((z + digitLength b k) * t) - 1) / (b ^ (z + digitLength b k) - 1))
/-- A finite list of congruences `n ≡ r (mod m)`, given as pairs `(r, m)`, is a covering system
if every integer satisfies at least one of them (Section 2). -/
def IsCoveringSystem (C : List (ℕ × ℕ)) : Prop :=
∀ n : ℤ, ∃ c ∈ C, n ≡ (c.1 : ℤ) [ZMOD (c.2 : ℤ)]
/-- The covering system method of Section 2 for Sierpiński numbers: triples `(r_j, m_j, p_j)` such
that the congruences `r_j (mod m_j)` form a covering system, each `p_j` is a prime divisor of
`2^{m_j} − 1`, the primes `p_j` are distinct, and `k ≡ −2^{−r_j} (mod p_j)`, written
`p_j ∣ k·2^{r_j} + 1`. -/
def SierpinskiCoveringMethod (k : ℕ) (C : List (ℕ × ℕ × ℕ)) : Prop :=
IsCoveringSystem (C.map fun c => (c.1, c.2.1)) ∧
(∀ c ∈ C, 0 < c.2.1 ∧ c.2.2.Prime ∧ c.2.2 ∣ 2 ^ c.2.1 - 1 ∧ c.2.2 ∣ k * 2 ^ c.1 + 1) ∧
(C.map fun c => c.2.2).Nodup
/-- The covering system method of Section 2 for Riesel numbers: as above, with
`k ≡ 2^{−r_j} (mod p_j)`, written `p_j ∣ k·2^{r_j} − 1`. -/
def RieselCoveringMethod (k : ℕ) (C : List (ℕ × ℕ × ℕ)) : Prop :=
IsCoveringSystem (C.map fun c => (c.1, c.2.1)) ∧
(∀ c ∈ C, 0 < c.2.1 ∧ c.2.2.Prime ∧ c.2.2 ∣ 2 ^ c.2.1 - 1 ∧ c.2.2 ∣ k * 2 ^ c.1 - 1) ∧
(C.map fun c => c.2.2).Nodup
end BispelsEtAl2026
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
This file defines nine notions, all over the natural numbers (except the covering-system congruence, which is tested over the integers ). Throughout, denotes truncated natural subtraction ( when ) and denotes floor division of natural numbers, with the convention .
Composite. For , means
So and are not composite.
Sierpiński. For , means: is odd, and for every natural number , the number is composite (in the sense above). Oddness forces . No lower bound other than oddness is imposed; for example is not excluded by the definition itself (whether it qualifies depends on the compositeness condition).
Riesel. For , means: is odd, and for every , the natural number is composite. Because odd gives and so , the truncated subtraction here agrees with ordinary subtraction whenever the oddness clause holds.
Digit length. For ,
where is Mathlib's natural-number logarithm: for and it is (the largest with ), so is the number of base- digits of . Junk values: , so ; and if then for all , so .
Repinteger. For , with ,
When , the divisor divides , so the floor division is exact and , i.e. . Edge and junk cases: if then and ; if then ; if then the divisor is , the division yields , and ; if then the divisor is and .
Repstring. For , with and ,
For this equals exactly. Same junk values as above: , , and for ; for the divisor is (as ), giving .
Covering system. A finite list of pairs of natural numbers is a covering system when
where the congruence is computed in as (Euclidean remainder). No condition , no condition , no distinctness of moduli and no minimality is imposed. If some , the congruence modulo means (since ). The empty list is never a covering system. A list containing a pair with is always a covering system.
Sierpiński covering method. For and a finite list of triples of natural numbers, means all three of:
- the pairs , in list order, form a covering system as above;
- for every triple in : , is prime, , and ;
- the primes (as a list) have no repetitions.
Since , is ordinary subtraction. Clause 2 forces odd (it divides the odd number , and has no prime divisor, so in fact ). Clause 1 forces non-empty. Nothing requires to have multiplicative order exactly , nor .
Riesel covering method. is identical except that clause 2 asks (truncated subtraction). Junk case: if then , which every divides, so the divisibility condition becomes vacuous for . For the subtraction is ordinary.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.