{
  "id": "6166",
  "ident": "NS.06166",
  "slug": "oeis-306424",
  "title": "Maximality of $k = 43$ with restricted digit counts in bases $3 \\le b < k$",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Conjecture: The sequence is finite, with 43 being the last term.\n\nA formal proof has been found with the methods described in\n[arxiv/2605.22763](https://arxiv.org/abs/2605.22763).",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "formal_proof"
  ],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA306424.forty_three_is_max",
  "statement_lean": "theorem forty_three_is_max : Condition 43 ∧ ∀ k : ℕ, 43 < k → ¬Condition k",
  "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# Maximality of $k = 43$ with restricted digit counts in bases $3 \\le b < k$\n\nNumbers $k$ such that the base $b$ expansion of $k$ for each\n$b = 3..k-1$ never contains more than two distinct digits.\n\nThe sequence Numbers $k$ such that the base $b$ expansion of $k$ for each\n$b = 3..k-1$ never contains more than two distinct digits.\n\n*References:*\n- [A306424](https://oeis.org/A306424)\n- [arxiv/2605.22763](https://arxiv.org/abs/2605.22763) *Advancing Mathematics Research with AI-Driven Formal Proof Search* by George Tsoukalas et al.\n-/\n\n@[expose] public section\n\nnamespace OeisA306424\n\n\nopen List Finset Nat\n\n/--\nNumbers $k$ such that the base $b$ expansion of $k$ for each\n$b = 3..k-1$ never contains more than two distinct digits.\n-/\ndef Condition (k : ℕ) : Prop :=\n  -- The bases $b$ range over $3 \\le b \\le k-1$, expressed as $3 \\le b$ and $b < k$.\n  ∀ b : ℕ, 3 ≤ b ∧ b < k → ((Nat.digits b k).toFinset.card) ≤ 2\n\n/--\nThe $n$-th number $k$ such that the base $b$ expansion of $k$ for each\n$b = 3..k-1$ never contains more than two distinct digits.\n-/\nnoncomputable def a (n : ℕ) : ℕ := n.nth Condition\n\n@[category test, AMS 11]\nlemma Condition_lt_four {k : ℕ} (hk : k ≤ 3) : Condition k := by\n  intro b ⟨hb1, hb2⟩\n  omega\n\n@[category test, AMS 11]\nlemma Condition_zero : Condition 0 := Condition_lt_four (by omega)\n\n@[category test, AMS 11]\nlemma Condition_one : Condition 1 := Condition_lt_four (by omega)\n\n@[category test, AMS 11]\nlemma Condition_two : Condition 2 := Condition_lt_four (by omega)\n\n@[category test, AMS 11]\nlemma Condition_three : Condition 3 := Condition_lt_four (by omega)\n\n@[category test, AMS 11]\nlemma Condition_four : Condition 4 := by\n  intro b ⟨hb1, hb2⟩\n  have hb : b = 3 := by omega\n  subst hb\n  decide\n\n@[category test, AMS 11]\nlemma Condition_five : Condition 5 := by\n  intro b ⟨hb1, hb2⟩\n  interval_cases b\n  · decide\n  · decide\n\n\n@[category test, AMS 11]\nlemma a_1 : a 1 = 1 := by\n  change Nat.nth Condition 1 = 1\n  rw [Nat.nth_eq_sInf]\n  have h0 : Nat.nth Condition 0 = 0 := Nat.nth_zero_of_zero Condition_zero\n  have hmem : 1 ∈ {x | Condition x ∧ ∀ k < 1, Nat.nth Condition k < x} := by\n    refine ⟨Condition_one, fun k hk => ?_⟩\n    interval_cases k\n    rw [h0]\n    exact zero_lt_one\n  have h_inf_mem := Nat.sInf_mem ⟨1, hmem⟩\n  have h_gt_zero := h_inf_mem.2 0 (by omega)\n  rw [h0] at h_gt_zero\n  have h_le_one : sInf {x | Condition x ∧ ∀ k < 1, Nat.nth Condition k < x} ≤ 1 :=\n    csInf_le (OrderBot.bddBelow _) hmem\n  omega\n\n@[category test, AMS 11]\nlemma a_2 : a 2 = 2 := by\n  change Nat.nth Condition 2 = 2\n  rw [Nat.nth_eq_sInf]\n  have h0 : Nat.nth Condition 0 = 0 := Nat.nth_zero_of_zero Condition_zero\n  have h1 : Nat.nth Condition 1 = 1 := a_1\n  have hmem : 2 ∈ {x | Condition x ∧ ∀ k < 2, Nat.nth Condition k < x} := by\n    refine ⟨Condition_two, fun k hk => ?_⟩\n    interval_cases k\n    · rw [h0]; exact zero_lt_two\n    · rw [h1]; exact one_lt_two\n  have h_inf_mem := Nat.sInf_mem ⟨2, hmem⟩\n  have h_gt_one := h_inf_mem.2 1 (by omega)\n  rw [h1] at h_gt_one\n  have h_le_two : sInf {x | Condition x ∧ ∀ k < 2, Nat.nth Condition k < x} ≤ 2 :=\n    csInf_le (OrderBot.bddBelow _) hmem\n  omega\n\n@[category test, AMS 11]\nlemma a_3 : a 3 = 3 := by\n  change Nat.nth Condition 3 = 3\n  rw [Nat.nth_eq_sInf]\n  have h0 : Nat.nth Condition 0 = 0 := Nat.nth_zero_of_zero Condition_zero\n  have h1 : Nat.nth Condition 1 = 1 := a_1\n  have h2 : Nat.nth Condition 2 = 2 := a_2\n  have hmem : 3 ∈ {x | Condition x ∧ ∀ k < 3, Nat.nth Condition k < x} := by\n    refine ⟨Condition_three, fun k hk => ?_⟩\n    interval_cases k\n    · rw [h0]; omega\n    · rw [h1]; omega\n    · rw [h2]; omega\n  have h_inf_mem := Nat.sInf_mem ⟨3, hmem⟩\n  have h_gt_two := h_inf_mem.2 2 (by omega)\n  rw [h2] at h_gt_two\n  have h_le_three : sInf {x | Condition x ∧ ∀ k < 3, Nat.nth Condition k < x} ≤ 3 :=\n    csInf_le (OrderBot.bddBelow _) hmem\n  omega\n\n@[category test, AMS 11]\nlemma a_4 : a 4 = 4 := by\n  change Nat.nth Condition 4 = 4\n  rw [Nat.nth_eq_sInf]\n  have h0 : Nat.nth Condition 0 = 0 := Nat.nth_zero_of_zero Condition_zero\n  have h1 : Nat.nth Condition 1 = 1 := a_1\n  have h2 : Nat.nth Condition 2 = 2 := a_2\n  have h3 : Nat.nth Condition 3 = 3 := a_3\n  have hmem : 4 ∈ {x | Condition x ∧ ∀ k < 4, Nat.nth Condition k < x} := by\n    refine ⟨Condition_four, fun k hk => ?_⟩\n    interval_cases k\n    · rw [h0]; omega\n    · rw [h1]; omega\n    · rw [h2]; omega\n    · rw [h3]; omega\n  have h_inf_mem := Nat.sInf_mem ⟨4, hmem⟩\n  have h_gt_three := h_inf_mem.2 3 (by omega)\n  rw [h3] at h_gt_three\n  have h_le_four : sInf {x | Condition x ∧ ∀ k < 4, Nat.nth Condition k < x} ≤ 4 :=\n    csInf_le (OrderBot.bddBelow _) hmem\n  omega\n\n@[category test, AMS 11]\nlemma a_5 : a 5 = 5 := by\n  change Nat.nth Condition 5 = 5\n  rw [Nat.nth_eq_sInf]\n  have h0 : Nat.nth Condition 0 = 0 := Nat.nth_zero_of_zero Condition_zero\n  have h1 : Nat.nth Condition 1 = 1 := a_1\n  have h2 : Nat.nth Condition 2 = 2 := a_2\n  have h3 : Nat.nth Condition 3 = 3 := a_3\n  have h4 : Nat.nth Condition 4 = 4 := a_4\n  have hmem : 5 ∈ {x | Condition x ∧ ∀ k < 5, Nat.nth Condition k < x} := by\n    refine ⟨Condition_five, fun k hk => ?_⟩\n    interval_cases k\n    · rw [h0]; omega\n    · rw [h1]; omega\n    · rw [h2]; omega\n    · rw [h3]; omega\n    · rw [h4]; omega\n  have h_inf_mem := Nat.sInf_mem ⟨5, hmem⟩\n  have h_gt_four := h_inf_mem.2 4 (by omega)\n  rw [h4] at h_gt_four\n  have h_le_five : sInf {x | Condition x ∧ ∀ k < 5, Nat.nth Condition k < x} ≤ 5 :=\n    csInf_le (OrderBot.bddBelow _) hmem\n  omega\n\n\nset_option linter.style.formal_proof_palomar false in\n/--\nConjecture: The sequence is finite, with 43 being the last term.\n\nA formal proof has been found with the methods described in\n[arxiv/2605.22763](https://arxiv.org/abs/2605.22763).\n-/\n@[category research solved, AMS 11, formal_proof using formal_conjectures at\n\"https://github.com/mo271/formal-conjectures/blob/a32396489dcb8f86c3549b93aa358ac6a10a3a1f/FormalConjectures/OEIS/306424.wip.lean#L276\"]\ntheorem forty_three_is_max : Condition 43 ∧ ∀ k : ℕ, 43 < k → ¬Condition k := by\n    sorry\n\nend OeisA306424\n",
  "statement_hash": "354280cd767d69d6ec027d19bca6fee2a1c54a1771e4caebd1ad21b90996165e",
  "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."
}