{
  "id": "4954",
  "ident": "NS.04954",
  "slug": "oeis-153330",
  "title": "Collatz step differences",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Conjecture 1: More than half of the terms are 0.\n- _Ya-Ping Lu_, May 04 2024",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA153330.conjecture1",
  "statement_lean": "theorem conjecture1 :\n    1 / 2 < Filter.atTop.liminf (fun n : ℕ ↦\n      (((Finset.Icc 1 n).filter (fun i ↦ a i = some 0)).card : ℝ) / (n : ℝ))",
  "challenge_source": "/-\nCopyright 2026 The Formal Conjectures Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    https://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-/\nmodule\n\npublic import FormalConjecturesUtil\n\n/-!\n# Collatz step differences\n\nDifferences in adjacent elements of the sequence quantifying the steps needed for $n$ to\nconverge to 1 in the Collatz Conjecture.\n$$a(n) = \\mathrm{A006577}(n+1) - \\mathrm{A006577}(n)$$\nfor $n > 0$.\n\n*References:*\n- [A153330](https://oeis.org/A153330)-/\n\n@[expose] public section\n\nnamespace OeisA153330\n\n/-- Single step of the Collatz mapping. -/\ndef collatzStep (n : ℕ) : ℕ :=\n  if n % 2 = 0 then n / 2 else 3 * n + 1\n\nopen Classical in\n/-- Number of iterations required to turn $n$ into 1 in the Collatz process,\nor `none` if $n$ does not terminate. -/\nnoncomputable def collatzSteps (n : ℕ) : Option ℕ :=\n  if n = 0 then none\n  else if ∃ k : ℕ, (collatzStep^[k]) n = 1 then\n    some (sInf {k : ℕ | (collatzStep^[k]) n = 1})\n  else\n    none\n\nopen Classical in\n/-- The sequence $a(n) = \\mathrm{A006577}(n+1) - \\mathrm{A006577}(n)$ for $n > 0$,\nor `none` if either $n$ or $n+1$ does not terminate. -/\nnoncomputable def a (n : ℕ) : Option ℤ :=\n  if n = 0 then none\n  else\n    match collatzSteps (n + 1), collatzSteps n with\n    | some s2, some s1 => some (s2 - s1)\n    | _, _ => none\n\n/-- Value of the sequence `a` at 0. -/\n@[category test, AMS 11]\ntheorem a_0 : a 0 = none := by rfl\n\n/-- Value of the sequence `a` at 1. -/\n@[category test, AMS 11]\ntheorem a_1 : a 1 = some 1 := by\n  have h1 : IsLeast {k : ℕ | (collatzStep^[k]) 1 = 1} 0 := ⟨rfl, by simp [lowerBounds]⟩\n  have h2 : IsLeast {k : ℕ | (collatzStep^[k]) 2 = 1} 1 := by\n    constructor\n    · rfl\n    · intro k hk; by_contra! h; interval_cases k; revert hk; decide\n  have hs1 : collatzSteps 1 = some 0 := by\n    have h : ∃ k, (collatzStep^[k]) 1 = 1 := ⟨0, h1.1⟩\n    rw [collatzSteps, if_neg (by omega), if_pos h, h1.csInf_eq]\n  have hs2 : collatzSteps 2 = some 1 := by\n    have h : ∃ k, (collatzStep^[k]) 2 = 1 := ⟨1, h2.1⟩\n    rw [collatzSteps, if_neg (by omega), if_pos h, h2.csInf_eq]\n  rw [a, if_neg (by omega), hs2, hs1]; rfl\n\n/-- Value of the sequence `a` at 2. -/\n@[category test, AMS 11]\ntheorem a_2 : a 2 = some 6 := by\n  have h2 : IsLeast {k : ℕ | (collatzStep^[k]) 2 = 1} 1 := by\n    constructor\n    · rfl\n    · intro k hk; by_contra! h; interval_cases k; revert hk; decide\n  have h3 : IsLeast {k : ℕ | (collatzStep^[k]) 3 = 1} 7 := by\n    constructor\n    · rfl\n    · intro k hk; by_contra! h; interval_cases k <;> revert hk <;> decide\n  have hs2 : collatzSteps 2 = some 1 := by\n    have h : ∃ k, (collatzStep^[k]) 2 = 1 := ⟨1, h2.1⟩\n    rw [collatzSteps, if_neg (by omega), if_pos h, h2.csInf_eq]\n  have hs3 : collatzSteps 3 = some 7 := by\n    have h : ∃ k, (collatzStep^[k]) 3 = 1 := ⟨7, h3.1⟩\n    rw [collatzSteps, if_neg (by omega), if_pos h, h3.csInf_eq]\n  rw [a, if_neg (by omega), hs3, hs2]; rfl\n\n/-- Value of the sequence `a` at 3. -/\n@[category test, AMS 11]\ntheorem a_3 : a 3 = some (-5) := by\n  have h3 : IsLeast {k : ℕ | (collatzStep^[k]) 3 = 1} 7 := by\n    constructor\n    · rfl\n    · intro k hk; by_contra! h; interval_cases k <;> revert hk <;> decide\n  have h4 : IsLeast {k : ℕ | (collatzStep^[k]) 4 = 1} 2 := by\n    constructor\n    · rfl\n    · intro k hk; by_contra! h; interval_cases k <;> revert hk <;> decide\n  have hs3 : collatzSteps 3 = some 7 := by\n    have h : ∃ k, (collatzStep^[k]) 3 = 1 := ⟨7, h3.1⟩\n    rw [collatzSteps, if_neg (by omega), if_pos h, h3.csInf_eq]\n  have hs4 : collatzSteps 4 = some 2 := by\n    have h : ∃ k, (collatzStep^[k]) 4 = 1 := ⟨2, h4.1⟩\n    rw [collatzSteps, if_neg (by omega), if_pos h, h4.csInf_eq]\n  rw [a, if_neg (by omega), hs4, hs3]; rfl\n\n/-- Value of the sequence `a` at 4. -/\n@[category test, AMS 11]\ntheorem a_4 : a 4 = some 3 := by\n  have h4 : IsLeast {k : ℕ | (collatzStep^[k]) 4 = 1} 2 := by\n    constructor\n    · rfl\n    · intro k hk; by_contra! h; interval_cases k <;> revert hk <;> decide\n  have h5 : IsLeast {k : ℕ | (collatzStep^[k]) 5 = 1} 5 := by\n    constructor\n    · rfl\n    · intro k hk; by_contra! h; interval_cases k <;> revert hk <;> decide\n  have hs4 : collatzSteps 4 = some 2 := by\n    have h : ∃ k, (collatzStep^[k]) 4 = 1 := ⟨2, h4.1⟩\n    rw [collatzSteps, if_neg (by omega), if_pos h, h4.csInf_eq]\n  have hs5 : collatzSteps 5 = some 5 := by\n    have h : ∃ k, (collatzStep^[k]) 5 = 1 := ⟨5, h5.1⟩\n    rw [collatzSteps, if_neg (by omega), if_pos h, h5.csInf_eq]\n  rw [a, if_neg (by omega), hs5, hs4]; rfl\n\n/-- The set of positive indices $n$ for which $a(n) = v$. -/\ndef indices (v : ℤ) : Set ℕ :=\n  {n : ℕ | 0 < n ∧ a n = some v}\n\n/--\nConjecture 1: More than half of the terms are 0.\n- _Ya-Ping Lu_, May 04 2024\n-/\n@[category research open, AMS 11]\ntheorem conjecture1 :\n    1 / 2 < Filter.atTop.liminf (fun n : ℕ ↦\n      (((Finset.Icc 1 n).filter (fun i ↦ a i = some 0)).card : ℝ) / (n : ℝ)) := by\n  sorry\n\n/--\nConjecture 2: 1, 6 and 16 appear only once and 3 appears twice in the sequence,\ni.e., $a(1) = 1$, $a(2) = 6$, $a(4) = a(5) = 3$, and $a(8) = 16$.\n- _Ya-Ping Lu_, May 04 2024\n-/\n@[category research open, AMS 11]\ntheorem conjecture2 :\n    indices 1 = {1} ∧\n    indices 6 = {2} ∧\n    indices 16 = {8} ∧\n    indices 3 = {4, 5} := by\n  sorry\n\n/--\nConjecture 3 (Ya-Ping Lu, 2024):\nExcept 1, 3 and 6, the absolute value of all terms can be written as $5x + 8y$ for $x, y \\in \\mathbb{N}$.\n(Note: in the OEIS comment, \"x and y are integers\" means $x$ and $y$ have the same sign,\ni.e., $|v| = 5x + 8y$ with $x, y \\ge 0$, since every integer is a $\\mathbb{Z}$-linear combination of 5 and 8).\n-/\n@[category research open, AMS 11]\ntheorem conjecture3 (n : ℕ) (v : ℤ) (hn : 0 < n) (ha : a n = some v)\n    (hv : v ≠ 1 ∧ v ≠ 3 ∧ v ≠ 6) :\n    ∃ x y : ℕ, v.natAbs = 5 * x + 8 * y := by\n  sorry\n\n/--\nConjecture 4 (Ya-Ping Lu, 2024):\nFor an $m$ that appears in the sequence, the ratio of the number of terms with value $m$ to that\nof $-m$ approaches 1 as $n \\to \\infty$, for any $|m| \\notin \\{1, 3, 6, 16\\}$.\n-/\n@[category research open, AMS 11]\ntheorem conjecture4 (m : ℤ) (hm : m.natAbs ∉ ({1, 3, 6, 16} : Finset ℕ))\n    (hocc : ∃ n, 0 < n ∧ a n = some m) :\n    Filter.atTop.Tendsto\n      (fun n : ℕ ↦\n        (((Finset.Icc 1 n).filter (fun i ↦ a i = some m)).card : ℝ) /\n        (((Finset.Icc 1 n).filter (fun i ↦ a i = some (-m))).card : ℝ))\n      (nhds 1) := by\n  sorry\n\nend OeisA153330\n",
  "statement_hash": "b86a32a1622b9e9b55d48a26eb0cd2d99fd9c8e3ae19534cf1e89d5f60cf09e0",
  "toolchain": "leanprover/lean4:v4.33.1",
  "upstream_commit": "f9b3868d5ca994a7bf95039bcec05338c0c21e2f",
  "workspace": "formal-conjectures",
  "field": "math",
  "formalization": "formal",
  "verification": "lean-kernel",
  "license": "Apache-2.0",
  "attribution": "google-deepmind/formal-conjectures contributors",
  "metric_name": null,
  "metric_direction": null,
  "critiques": [],
  "public_partial_proofs": [],
  "research_threads": [],
  "instructions": "Read research_threads first: other people's public repositories and what they already tried. Write Solution.lean starting from challenge_source. Keep every definition identical, prove decl_name with exactly the same type, no sorry in its dependency closure, no new axioms, no native_decide, no metaprogramming. Submit with POST /api/v1/submissions."
}