{
  "id": "6940",
  "ident": "NS.06940",
  "slug": "oeis-87719",
  "title": "Conjectures associated with A087719",
  "status": "textbook",
  "statement_status": "reviewed",
  "statement_md": "There exists m such that countExceeding n m > countNotExceeding n m.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA87719.a_exists",
  "statement_lean": "theorem a_exists (n : ℕ) : ∃ m, countExceeding n m > countNotExceeding n m",
  "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# Conjectures associated with A087719\n\nDefine $\\varsigma(n)$ the smallest prime factor of $n$ (`Nat.minFac`). Let $a_n$ be the least\nnumber such that the count of numbers $k \\le a_n$ with $k > \\varsigma(k)^n$ exceeds the count\nof numbers with $k \\le \\varsigma(k)^n$.\n\nThe conjecture states that $a_n = 3^n + 3 \\cdot 2^n + 6$ for $n \\ge 1$.\n\n*References:*\n- [A087719](https://oeis.org/A087719)\n-/\n\n@[expose] public section\n\nnamespace OeisA87719\n\nopen Nat\n\n/-- Count of numbers k in {1, ..., m} where k > (minFac k)^n. -/\ndef countExceeding (n m : ℕ) : ℕ :=\n  (Finset.Icc 1 m).filter (fun k => k > k.minFac ^ n) |>.card\n\n/-- Count of numbers k in {1, ..., m} where k ≤ (minFac k)^n. -/\ndef countNotExceeding (n m : ℕ) : ℕ :=\n  (Finset.Icc 1 m).filter (fun k => k ≤ k.minFac ^ n) |>.card\n\n/-- There exists m such that countExceeding n m > countNotExceeding n m. -/\n@[category textbook, AMS 11]\ntheorem a_exists (n : ℕ) : ∃ m, countExceeding n m > countNotExceeding n m := by\n  -- Take `m = 6 * (3 ^ n + 1)`. A number `k > 3 ^ n` that is divisible by `2` or `3` exceeds\n  -- `minFac k ^ n`. So a number that does not exceed is at most `3 ^ n` or coprime to `6`.\n  set M := 3 ^ n + 1 with hM\n  refine ⟨6 * M, ?_⟩\n  have hpart : countExceeding n (6 * M) + countNotExceeding n (6 * M) = 6 * M := by\n    have := Finset.card_filter_add_card_filter_not (s := Finset.Icc 1 (6 * M))\n      (fun k => k > k.minFac ^ n)\n    simpa [countExceeding, countNotExceeding, not_lt] using this\n  have hsub : (Finset.Icc 1 (6 * M)).filter (fun k => k ≤ k.minFac ^ n) ⊆\n      Finset.Icc 1 (3 ^ n) ∪ ((Finset.range M).image (fun j => 6 * j + 1) ∪\n        (Finset.range M).image (fun j => 6 * j + 5)) := by\n    intro k hk\n    obtain ⟨hk1, hk2⟩ := Finset.mem_filter.mp hk\n    obtain ⟨hk1a, hk1b⟩ := Finset.mem_Icc.mp hk1\n    by_cases hle : k ≤ 3 ^ n\n    · exact Finset.mem_union_left _ (Finset.mem_Icc.mpr ⟨hk1a, hle⟩)\n    · refine Finset.mem_union_right _ ?_\n      have h23 := Nat.pow_le_pow_left (show 2 ≤ 3 by norm_num) n\n      have h2 : ¬ 2 ∣ k := fun h => by\n        have := Nat.pow_le_pow_left (Nat.minFac_le_of_dvd (le_refl 2) h) n\n        omega\n      have h3 : ¬ 3 ∣ k := fun h => by\n        have := Nat.pow_le_pow_left (Nat.minFac_le_of_dvd (show 2 ≤ 3 by norm_num) h) n\n        omega\n      have hmod : k % 6 = 1 ∨ k % 6 = 5 := by omega\n      rcases hmod with h | h\n      · exact Finset.mem_union_left _\n          (Finset.mem_image.mpr ⟨k / 6, Finset.mem_range.mpr (by omega), by omega⟩)\n      · exact Finset.mem_union_right _\n          (Finset.mem_image.mpr ⟨k / 6, Finset.mem_range.mpr (by omega), by omega⟩)\n  have hcard : countNotExceeding n (6 * M) ≤ 3 ^ n + (M + M) := by\n    unfold countNotExceeding\n    refine (Finset.card_le_card hsub).trans ((Finset.card_union_le _ _).trans ?_)\n    refine Nat.add_le_add (by simp) ((Finset.card_union_le _ _).trans (Nat.add_le_add ?_ ?_))\n    · exact Finset.card_image_le.trans (by simp)\n    · exact Finset.card_image_le.trans (by simp)\n  omega\n\n/-- The sequence a(n): least m such that countExceeding n m > countNotExceeding n m. -/\nnoncomputable def a (n : ℕ) : ℕ :=\n  Nat.find (a_exists n)\n\n/-- a(1) = 15. -/\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 15 := by\n  rw [a, Nat.find_eq_iff]\n  refine ⟨by decide +native, ?_⟩\n  intro m hm\n  interval_cases m <;> decide +native\n\n/-- a(2) = 27. -/\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 27 := by\n  rw [a, Nat.find_eq_iff]\n  refine ⟨by decide +native, ?_⟩\n  intro m hm\n  interval_cases m <;> decide +native\n\n/-- a(3) = 57. -/\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 57 := by\n  rw [a, Nat.find_eq_iff]\n  refine ⟨by decide +native, ?_⟩\n  intro m hm\n  interval_cases m <;> decide +native\n\n/-- We have the following formula: $a(n) = 3^n + 3 * 2^n + 6$ for $n \\geq 1$. -/\n@[category textbook, AMS 11,\n  formal_proof using formal_conjectures at\n    \"https://github.com/google-deepmind/formal-conjectures/blob/7a286754f623759d69a3dd18f482c53c1d70959b/FormalConjectures/OEIS/87719.lean#L640\"]\ntheorem a_formula {n : ℕ} (hn : n ≥ 1) : a n = 3 ^ n + 3 * 2 ^ n + 6 := by\n  sorry\n\nend OeisA87719\n",
  "statement_hash": "7af9a9038720d71cf6991b7cbd0a38641d01894ea2bd5db5f349070362e373cd",
  "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."
}