greedy_distinct_diff_next
def
Given the terms so far (most recent first), the next greedy term: the least positive integer not used yet whose absolute difference with the last term differs from every consecutive difference so far.
Statement
noncomputable def greedy_distinct_diff_next (l : List ℕ) : ℕ
- Defined in
- arXiv:2610.15860 (A note on the Slater–Vélez permutation), first paragraph (the greedy rule), and the 1977 paper it cites, 'Permutations of the positive integers with restrictions on the sequence of differences'.
- Verified
- 14 Oct 2026
- Axioms
- none listed
- Used by 3
- greedy_distinct_diff_seq_one_two_twoThe greedy sequence started at 1, 2 has third term 4 (3 is refused since |3 − 2| = 1 is already a difference).
- greedy_distinct_diff_seq_surjectiveConjecture: for any distinct positive integers a₁, a₂, the greedy sequence with distinct consecutive differences started at a₁, a₂ takes…
- greedy_distinct_diff_historyThe first n + 2 terms of the greedy sequence started at a₁, a₂, most recent first.
Lean source view module on GitHub
/-- The next term of the greedy sequence with distinct consecutive differences. -/ noncomputable def greedy_distinct_diff_next (l : List ℕ) : ℕ := sInf {c : ℕ | 0 < c ∧ c ∉ l ∧ Int.natAbs ((c : ℤ) - l.headD 0) ∉ (l.zip l.tail).map (fun p => Int.natAbs ((p.1 : ℤ) - p.2))}