{
  "id": "8215",
  "ident": "NS.08215",
  "slug": "wikipedia-minimalprime",
  "title": "Minimal primes in radix bases",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Base-$10$ classification (Shallit 2000): exactly $26$ primes satisfy\n`IsMinimalPrimeInBase 10 p`.",
  "subjects": [
    "math.NT",
    "math.CO",
    "msc:11",
    "msc:68"
  ],
  "tags": [],
  "collection": "wikipedia",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "MinimalPrime.base_ten_minimal_primes_card",
  "statement_lean": "theorem base_ten_minimal_primes_card :\n    {p : ℕ | IsMinimalPrimeInBase 10 p}.ncard = 26",
  "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# Minimal primes in radix bases\n\nFix an integer base $b \\ge 2$. A prime $p$ is *minimal in base $b$* if no proper subsequence (not\nnecessarily contiguous) of its canonical base-$b$ expansion represents a prime—equivalently, no\nprime $q \\neq p$ has its canonical base-$b$ digit list as a sublist of `Nat.digits b p`. By\nHigman's lemma, the set of minimal primes in base $b$ is finite for every $b \\ge 2$. Jeffrey\nShallit (2000) classified all $26$ base-$10$ minimal primes (`OEIS A071062`, up to $66600049$).\nCurtis Bright, Raymond Devillers, and Shallit (2016) extended minimal-prime classifications to\nlarger bases; in base $17$, they already reduced the classification to $1279$ minimal probable\nprimes (not all certified prime) together with the single unresolved candidate family\n$\\mathrm{F}1\\{9\\}$ (base-$17$ digits $15, 1, 9, \\dots, 9$).\n\n*References:*\n- [Wikipedia](https://en.wikipedia.org/wiki/Minimal_prime_(recreational_mathematics))\n- [OEIS A071062](https://oeis.org/A071062)\n- J. Shallit, *Minimal primes*, J. Recreational Math. **30** (1999–2000), 113–117.\n- C. Bright, R. Devillers, and J. Shallit, *Minimal elements for the prime numbers*, Exp. Math.\n  **25** (2016), 321–331.\n-/\n\n@[expose] public section\n\nnamespace MinimalPrime\n\n/-- Prime $p$ is minimal in base $b \\ge 2$ when no prime $q \\neq p$ has `Nat.digits b q` as a\nsublist of `Nat.digits b p`. -/\ndef IsMinimalPrimeInBase (b p : ℕ) : Prop :=\n  2 ≤ b ∧ p.Prime ∧ ¬∃ q : ℕ, q.Prime ∧ q ≠ p ∧ (Nat.digits b q).Sublist (Nat.digits b p)\n\n/-- Base $10$ includes $2$ as minimal and excludes $13$ (via proper sublist $3$), while bases\n$b \\in \\{0, 1\\}$ are excluded. -/\n@[category test, AMS 11 68]\ntheorem two_minimal_and_thirteen_not_minimal_base_ten :\n    IsMinimalPrimeInBase 10 2 ∧\n      ¬IsMinimalPrimeInBase 10 13 ∧\n      ¬IsMinimalPrimeInBase 0 2 ∧\n      ¬IsMinimalPrimeInBase 1 2 := by\n  refine ⟨⟨by omega, Nat.prime_two, ?_⟩, ?_, fun h => by have := h.1; omega,\n    fun h => by have := h.1; omega⟩\n  · rintro ⟨q, hq, hne, hsub⟩\n    have hd : Nat.digits 10 2 = [2] := by decide\n    rw [hd, List.sublist_singleton] at hsub\n    rcases hsub with h0 | h2\n    · exact hq.ne_zero (Nat.digits_eq_nil_iff_eq_zero.mp h0)\n    · have := congrArg (Nat.ofDigits 10) h2\n      rw [Nat.ofDigits_digits] at this\n      exact hne this\n  · rintro ⟨_, _, hno⟩\n    exact hno ⟨3, by decide, by decide, by decide⟩\n\n/-- Single-digit primes $p \\in \\{3, 5, 7\\}$ satisfy `IsMinimalPrimeInBase 10 p`, whereas $1$\nsatisfies `¬ IsMinimalPrimeInBase b 1` for every $b$. -/\n@[category test, AMS 11 68]\ntheorem single_digit_primes_minimal_base_ten :\n    IsMinimalPrimeInBase 10 3 ∧\n    IsMinimalPrimeInBase 10 5 ∧\n    IsMinimalPrimeInBase 10 7 ∧\n    ∀ b : ℕ, ¬ IsMinimalPrimeInBase b 1 := by\n  have hmin : ∀ p : ℕ, p.Prime → p < 10 → IsMinimalPrimeInBase 10 p := by\n    intro p hp hlt\n    refine ⟨by omega, hp, ?_⟩\n    rintro ⟨q, hq, hne, hsub⟩\n    have hd : Nat.digits 10 p = [p] := Nat.digits_of_lt 10 p hp.ne_zero hlt\n    rw [hd, List.sublist_singleton] at hsub\n    rcases hsub with h0 | hp_eq\n    · exact hq.ne_zero (Nat.digits_eq_nil_iff_eq_zero.mp h0)\n    · have := congrArg (Nat.ofDigits 10) hp_eq\n      rw [Nat.ofDigits_digits, Nat.ofDigits_singleton] at this\n      exact hne this\n  exact ⟨hmin 3 (by decide) (by omega), hmin 5 (by decide) (by omega),\n    hmin 7 (by decide) (by omega), fun _ h => Nat.not_prime_one h.2.1⟩\n\n/-- In binary ($b = 2$), $2 = (10)_2$ is minimal, whereas in base $10$ neither $23$ nor $37$ is\nminimal. -/\n@[category test, AMS 11 68]\ntheorem binary_two_minimal_and_base_ten_nonminimal :\n    IsMinimalPrimeInBase 2 2 ∧\n    ¬ IsMinimalPrimeInBase 10 23 ∧\n    ¬ IsMinimalPrimeInBase 10 37 := by\n  refine ⟨⟨by omega, Nat.prime_two, ?_⟩, ?_, ?_⟩\n  · rintro ⟨q, hq, hne, hsub⟩\n    have hd : Nat.digits 2 2 = [0, 1] := by decide\n    rw [hd] at hsub\n    have hval : q = Nat.ofDigits 2 (Nat.digits 2 q) := (Nat.ofDigits_digits 2 q).symm\n    rcases List.sublist_cons_iff.mp hsub with hsub1 | ⟨l, hdig, hsub1⟩\n    · rcases List.sublist_singleton.mp hsub1 with h0 | h1\n      · rw [h0] at hval; rw [hval] at hq; revert hq; decide\n      · rw [h1] at hval; rw [hval] at hq; revert hq; decide\n    · rcases List.sublist_singleton.mp hsub1 with h0 | h1\n      · rw [hdig, h0] at hval; rw [hval] at hq; revert hq; decide\n      · rw [hdig, h1] at hval; rw [hval] at hne; revert hne; decide\n  · rintro ⟨_, _, hno⟩\n    exact hno ⟨3, by decide, by decide, by decide⟩\n  · rintro ⟨_, _, hno⟩\n    exact hno ⟨7, by decide, by decide, by decide⟩\n\n/-- Finiteness of minimal primes (empty for $b < 2$, and finite by Higman's lemma for $b \\ge 2$):\nfor every $b \\in \\mathbb{N}$, the set of primes satisfying `IsMinimalPrimeInBase b p` is finite. -/\n@[category textbook, AMS 11 68]\ntheorem minimal_primes_finite_in_every_base (b : ℕ) :\n    {p : ℕ | IsMinimalPrimeInBase b p}.Finite := by\n  sorry\n\n/-- Base-$10$ classification (Shallit 2000): exactly $26$ primes satisfy\n`IsMinimalPrimeInBase 10 p`. -/\n@[category research solved, AMS 11 68]\ntheorem base_ten_minimal_primes_card :\n    {p : ℕ | IsMinimalPrimeInBase 10 p}.ncard = 26 := by\n  sorry\n\n/-- Explicit base-$10$ minimal prime set (Shallit 2000, `OEIS A071062`): the primes satisfying\n`IsMinimalPrimeInBase 10 p` are precisely the $26$ integers listed below. -/\n@[category research solved, AMS 11 68]\ntheorem base_ten_minimal_primes_eq :\n    {p : ℕ | IsMinimalPrimeInBase 10 p} =\n      {2, 3, 5, 7, 11, 19, 41, 61, 89, 409, 449, 499, 881, 991, 6469, 6949, 9001, 9049, 9649,\n        9949, 60649, 666649, 946669, 60000049, 66000049, 66600049} := by\n  sorry\n\n/-- Unresolved base-$17$ candidate family $\\mathrm{F}1\\{9\\}$: does there exist $k \\in \\mathbb{N}$\nsuch that the integer with base-$17$ digits $15, 1, \\underbrace{9, \\dots, 9}_{k}$ (namely\n$15 \\cdot 17^{k + 1} + 17^k + \\sum_{i < k} 9 \\cdot 17^i$) satisfies\n`IsMinimalPrimeInBase 17`? -/\n@[category research open, question, AMS 11 68]\ntheorem base_seventeen_f19_family_minimal_prime_question :\n    ∃ k : ℕ, IsMinimalPrimeInBase 17\n      (15 * 17 ^ (k + 1) + 17 ^ k + ∑ i ∈ Finset.range k, 9 * 17 ^ i) := by\n  sorry\n\nend MinimalPrime\n",
  "statement_hash": "8ffdd53427c137f0bbc9a4340f5b67235dfea170782393f48ef18620b71ba30c",
  "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."
}