OEIS A166944 — Rowland-type recurrence, first differences, difference records, and the record/twin-prime target
Definitiona166944_record_coreThis bundle fixes the object of study of OEIS A166944 and the exact sense in which its difference records are conjectured to be twin primes.
The sequence is the Rowland-type recursion
so that the gcd argument is the even index itself in the even branch and the index two below it in the odd branch. Write for the first differences and for the offset of the sequence from the identity.
A natural number is a difference record when at some index and for every ; that is, is a strict running maximum of the difference sequence and the record is attained. A number is the greater member of a twin-prime pair when and are both prime.
The target of the A166944 investigation is then
In words: every difference record above is the larger half of a twin-prime pair. This is the A166944 conjecture, and it is open; the present bundle only fixes its vocabulary, so that the partial results already proved about it — and any future proof of the whole statement — are stated against one shared interface. Publishing these declarations separately also keeps every later theorem free of local defs, so that downstream work can import them by name.
Formalization Note The recurrence is indexed so that the even/odd branch is selected by the index of the new term, matching the OEIS definition. d is truncated subtraction on Nat, so d 0 = 0 and d 1 = 2; every record statement in this development considers only indices , where the subtraction is known not to truncate. Target is deliberately a bare Prop so that it can be assumed as a hypothesis rather than asserted.
-- Simulated Prove2Me definition bundle: exactly what /submit-definition would carry.
import Mathlib.Data.Nat.Prime.Defs
namespace A166944Research
/-- The Rowland-type recurrence of OEIS A166944. -/
def a : Nat → Nat
| 0 => 0
| 1 => 2
| n + 2 =>
let prev := a (n + 1)
let idx := n + 2
if idx % 2 = 0 then prev + Nat.gcd idx prev
else prev + Nat.gcd (idx - 2) prev
/-- First differences. -/
def d (n : Nat) : Nat := a n - a (n - 1)
/-- Offset of the sequence from the identity: `D n = a n - n`. -/
def D (n : Nat) : Nat := a n - n
/-- `R` is a difference record. -/
def IsDifferenceRecord (R : Nat) : Prop :=
∃ n : Nat, 2 ≤ n ∧ d n = R ∧ ∀ k : Nat, 2 ≤ k → k < n → d k < R
/-- `p` is the greater member of a twin-prime pair. -/
def IsGreaterTwinPrime (p : Nat) : Prop := p.Prime ∧ (p - 2).Prime
/-- The A166944 conjecture, as a proposition. -/
def Target : Prop :=
∀ R : Nat, 5 < R → IsDifferenceRecord R → IsGreaterTwinPrime R
end A166944Research