Title:The cup-of-coffee sequence
Statement:Conjectured to be a permutation of the positive integers.
| Subjects: | Number Theory (math.NT) |
| MSC classes: | 11 |
| Cite as: | NS.06092 [math.NT] · NS.06092v1 for this version |
| Declaration: | OeisA280864.conjecture |
| Verification: | Lean kernel (formal proof) |
| Points: | first verified proof or disproof: 100, later ones: 10; accepted critique: up to 60 |
| Statement hash: | 864da1c5b1a49b2c1f9bc7218a43af468c13bedc16e96a7559ecdc492c980fec |
| Toolchain: | leanprover/lean4:v4.33.1 |
| Licence: | Apache-2.0 · google-deepmind/formal-conjectures contributors |
| Upstream: | FormalConjectures/OEIS/280864.lean |
Formal statement
theorem conjecture :
∃ a : ℕ → ℕ, FollowsRule a ∧ ∀ k > 0, ∃ n, a n = kShow the full Challenge.lean (243 lines) — definitions included
module
public import FormalConjecturesUtil
/-!
# The cup-of-coffee sequence
The sequence starts with $1, 2$. Each later term is the least unused positive integer such that,
for every prime, runs of consecutive multiples have length exactly two. The local rule requires
prime factors that have just appeared to occur once more, and forbids prime factors that occurred
in both of the preceding terms.
*References:*
- [A280864](https://oeis.org/A280864)
-/
@[expose] public section
namespace OeisA280864
/-- Prime factors whose run began at `previous` and must continue at the next term. -/
def requiredFactors (previousPrevious previous : ℕ) : Finset ℕ :=
previous.primeFactors \ previousPrevious.primeFactors
/-- Prime factors whose run has length two and must end before the next term. -/
def forbiddenFactors (previousPrevious previous : ℕ) : Finset ℕ :=
previous.primeFactors ∩ previousPrevious.primeFactors
/-- Whether `candidate` obeys the prime-factor run rule after the two preceding values. -/
def Eligible (previousPrevious previous candidate : ℕ) : Prop :=
0 < candidate ∧
(∀ p ∈ requiredFactors previousPrevious previous, p ∣ candidate) ∧
(∀ p ∈ forbiddenFactors previousPrevious previous, ¬p ∣ candidate)
@[category test, AMS 11]
theorem not_eligible_zero : ¬Eligible 1 2 0 := by
simp [Eligible]
@[category test, AMS 11]
theorem not_eligible_missing_required_factor : ¬Eligible 1 2 3 := by
norm_num [Eligible, requiredFactors, forbiddenFactors, Nat.primeFactors, Nat.primeFactorsList]
@[category test, AMS 11]
theorem not_eligible_with_forbidden_factor : ¬Eligible 2 4 8 := by
norm_num [Eligible, requiredFactors, forbiddenFactors, Nat.primeFactors, Nat.primeFactorsList]
@[category test, AMS 11]
theorem eligible_3_6_8 : Eligible 3 6 8 := by
norm_num [Eligible, requiredFactors, forbiddenFactors, Nat.primeFactors, Nat.primeFactorsList]
/-- The value `candidate` has not appeared before index `n`. -/
def UnusedBefore (a : ℕ → ℕ) (n candidate : ℕ) : Prop :=
∀ i < n, a i ≠ candidate
/-- At index `n`, the sequence takes the least unused eligible positive value. -/
def GreedyAt (a : ℕ → ℕ) (n : ℕ) : Prop :=
Eligible (a (n - 2)) (a (n - 1)) (a n) ∧
UnusedBefore a n (a n) ∧
∀ candidate,
Eligible (a (n - 2)) (a (n - 1)) candidate →
UnusedBefore a n candidate →
a n ≤ candidate
/-- A total sequence obeys the initial conditions and every subsequent greedy step. -/
def FollowsRule (a : ℕ → ℕ) : Prop :=
a 0 = 1 ∧ a 1 = 2 ∧ ∀ n, 2 ≤ n → GreedyAt a n
/-- A later value in a rule-following sequence differs from every earlier value. -/
@[category API, AMS 11]
theorem ne_of_lt_of_followsRule {a : ℕ → ℕ} (ha : FollowsRule a) {i j : ℕ} (hij : i < j) :
a i ≠ a j := by
rcases ha with ⟨ha0, ha1, ha⟩
match j with
| 0 => omega
| 1 =>
have hi : i = 0 := by omega
subst i
simp [ha0, ha1]
| j + 2 =>
exact (ha (j + 2) (by omega)).2.1 i hij
/-- Unusedness at every greedy step makes every rule-following sequence injective. -/
@[category API, AMS 11]
theorem followsRule_injective {a : ℕ → ℕ} (ha : FollowsRule a) : Function.Injective a := by
intro i j hij
by_contra hne
rcases lt_or_gt_of_ne hne with hlt | hgt
· exact ne_of_lt_of_followsRule ha hlt hij
· exact ne_of_lt_of_followsRule ha hgt hij.symm
/-- `candidate` is the least unused eligible value following the two displayed final values. -/
def LeastEligibleUnused (history : List ℕ) (previousPrevious previous candidate : ℕ) : Prop :=
Eligible previousPrevious previous candidate ∧
candidate ∉ history ∧
∀ smaller ∈ Finset.Ico 1 candidate,
¬Eligible previousPrevious previous smaller ∨ smaller ∈ history
/-- A finite list generated by the same greedy rule, without assuming an infinite continuation. -/
inductive ValidPrefix : List ℕ → Prop
| nil : ValidPrefix []
| one : ValidPrefix [1]
| two : ValidPrefix [1, 2]
| append {history : List ℕ} {previousPrevious previous candidate : ℕ}
(valid : ValidPrefix (history ++ [previousPrevious, previous]))
(least : LeastEligibleUnused (history ++ [previousPrevious, previous])
previousPrevious previous candidate) :
ValidPrefix (history ++ [previousPrevious, previous, candidate])
/--
A value occurs at the official OEIS index $n\geq 1$ in a finite valid prefix.
The total sequences in `FollowsRule` use index $n-1$ for the same term.
-/
def TermAt (n value : ℕ) : Prop :=
0 < n ∧ ∃ xs, ValidPrefix xs ∧ xs[n - 1]? = some value
/-- Index zero is outside the official OEIS domain. -/
@[category test, AMS 11]
theorem not_term_at_zero (value : ℕ) : ¬TermAt 0 value := by
simp [TermAt]
private def initialPrefix : List ℕ := [1, 2, 4, 3, 6, 8, 5, 10, 12, 9]
@[category API, AMS 11]
private theorem initialPrefix_valid : ValidPrefix initialPrefix := by
have h2 : ValidPrefix [1, 2] := ValidPrefix.two
have h3 : ValidPrefix [1, 2, 4] := by
simpa using ValidPrefix.append (history := []) (previousPrevious := 1) (previous := 2)
(candidate := 4) h2 (by
norm_num [LeastEligibleUnused, Eligible, requiredFactors, forbiddenFactors,
Nat.primeFactors, Nat.primeFactorsList]
intro smaller hsmall hlt
interval_cases smaller <;> norm_num)
have h4 : ValidPrefix [1, 2, 4, 3] := by
simpa using ValidPrefix.append (history := [1]) h3 (by
norm_num [LeastEligibleUnused, Eligible, requiredFactors, forbiddenFactors,
Nat.primeFactors, Nat.primeFactorsList]
intro smaller hsmall hlt
interval_cases smaller <;> norm_num)
have h5 : ValidPrefix [1, 2, 4, 3, 6] := by
simpa using ValidPrefix.append (history := [1, 2]) h4 (by
norm_num [LeastEligibleUnused, Eligible, requiredFactors, forbiddenFactors,
Nat.primeFactors, Nat.primeFactorsList]
intro smaller hsmall hlt
interval_cases smaller <;> norm_num)
have h6 : ValidPrefix [1, 2, 4, 3, 6, 8] := by
simpa using ValidPrefix.append (history := [1, 2, 4]) h5 (by
norm_num [LeastEligibleUnused, Eligible, requiredFactors, forbiddenFactors,
Nat.primeFactors, Nat.primeFactorsList]
intro smaller hsmall hlt
interval_cases smaller <;> norm_num)
have h7 : ValidPrefix [1, 2, 4, 3, 6, 8, 5] := by
simpa using ValidPrefix.append (history := [1, 2, 4, 3]) h6 (by
norm_num [LeastEligibleUnused, Eligible, requiredFactors, forbiddenFactors,
Nat.primeFactors, Nat.primeFactorsList]
intro smaller hsmall hlt
interval_cases smaller <;> norm_num)
have h8 : ValidPrefix [1, 2, 4, 3, 6, 8, 5, 10] := by
simpa using ValidPrefix.append (history := [1, 2, 4, 3, 6]) h7 (by
norm_num [LeastEligibleUnused, Eligible, requiredFactors, forbiddenFactors,
Nat.primeFactors, Nat.primeFactorsList]
intro smaller hsmall hlt
interval_cases smaller <;> norm_num)
have h9 : ValidPrefix [1, 2, 4, 3, 6, 8, 5, 10, 12] := by
simpa using ValidPrefix.append (history := [1, 2, 4, 3, 6, 8]) h8 (by
norm_num [LeastEligibleUnused, Eligible, requiredFactors, forbiddenFactors,
Nat.primeFactors, Nat.primeFactorsList]
intro smaller hsmall hlt
interval_cases smaller <;> norm_num)
have h10 : ValidPrefix initialPrefix := by
simpa [initialPrefix] using
ValidPrefix.append (history := [1, 2, 4, 3, 6, 8, 5]) h9 (by
norm_num [LeastEligibleUnused, Eligible, requiredFactors, forbiddenFactors,
Nat.primeFactors, Nat.primeFactorsList]
intro smaller hsmall hlt
interval_cases smaller <;> norm_num)
exact h10
@[category test, AMS 11]
theorem a_1 : TermAt 1 1 := by
exact ⟨by decide, initialPrefix, initialPrefix_valid, by decide⟩
@[category test, AMS 11]
theorem a_2 : TermAt 2 2 := by
exact ⟨by decide, initialPrefix, initialPrefix_valid, by decide⟩
@[category test, AMS 11]
theorem a_3 : TermAt 3 4 := by
exact ⟨by decide, initialPrefix, initialPrefix_valid, by decide⟩
@[category test, AMS 11]
theorem a_4 : TermAt 4 3 := by
exact ⟨by decide, initialPrefix, initialPrefix_valid, by decide⟩
@[category test, AMS 11]
theorem a_5 : TermAt 5 6 := by
exact ⟨by decide, initialPrefix, initialPrefix_valid, by decide⟩
@[category test, AMS 11]
theorem a_6 : TermAt 6 8 := by
exact ⟨by decide, initialPrefix, initialPrefix_valid, by decide⟩
@[category test, AMS 11]
theorem a_7 : TermAt 7 5 := by
exact ⟨by decide, initialPrefix, initialPrefix_valid, by decide⟩
@[category test, AMS 11]
theorem a_8 : TermAt 8 10 := by
exact ⟨by decide, initialPrefix, initialPrefix_valid, by decide⟩
@[category test, AMS 11]
theorem a_9 : TermAt 9 12 := by
exact ⟨by decide, initialPrefix, initialPrefix_valid, by decide⟩
@[category test, AMS 11]
theorem a_10 : TermAt 10 9 := by
exact ⟨by decide, initialPrefix, initialPrefix_valid, by decide⟩
/--
Conjectured to be a permutation of the positive integers.
-/
@[category research open, AMS 11]
theorem conjecture :
∃ a : ℕ → ℕ, FollowsRule a ∧ ∀ k > 0, ∃ n, a n = k := by
sorry
end OeisA280864
To prove it: keep every definition of Challenge.lean unchanged and prove OeisA280864.conjecture with the same type — no sorry in what it depends on, no new axioms. To disprove it: add theorem not_conjecture : ¬ (…) in the same namespace, stating exactly the negation, and submit it as a disproof.
nosorry fetch oeis-280864 nosorry submit oeis-280864 nosorry/oeis-280864/Solution.lean --wait
Contributions
No contributions yet — be the first. Submit a proof or a finding.
Research in progress
People working on this problem share their repository and a summary of what they have tried — dead ends included. Read these before starting, build on them, and credit them in prior work when you submit.
Nobody has shared research on this problem yet.
Sign in to share your research.
Statement review
Is the formal statement faithful to the problem? Too weak, too strong, already solved in the literature? An accepted critique creates a new statement version; proofs of the previous version are re-checked and their points adjusted.
Sign in to open a critique.