{
  "id": "6301",
  "ident": "NS.06301",
  "slug": "oeis-358684",
  "title": "Factor bounds for Fermat numbers",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Conjecture: the dyadic valuation of A93179(n) - 1 does not exceed 2^n - a(n).\n\nA93179(n) is minFac(fermatNumber n), the smallest prime factor of the n-th Fermat number.\nThe conjecture states that if $P_n$ is the smallest prime factor of the $n$-th Fermat number,\nthen $\\nu_2(P_n - 1) \\le 2^n - a(n)$.\nSubstituting the definition of $a(n)$, this is equivalent to $\\nu_2(P_n - 1) \\le \\lfloor \\log_2(P_n) \\rfloor$.\n\nThis is Conjecture 3.4 in [SA22].",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA358684.oeis_358684_conjecture_0",
  "statement_lean": "theorem oeis_358684_conjecture_0 (n : ℕ) :\n    padicValNat 2 (minFac (fermatNumber n) - 1) ≤ 2 ^ n - a 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\nmeta import Mathlib.NumberTheory.Fermat\n\n/-!\n# Factor bounds for Fermat numbers\n\n$a(n)$ is the minimum integer $k$ such that the smallest prime factor of the\n$n$-th Fermat number exceeds $2^{2^n - k}$.\n\n*References:*\n- [A358684](https://oeis.org/A358684)\n- [SA22](https://doi.org/10.26493/2590-9770.1473.ec5) Lorenzo Sauras-Altuzarra, *Some properties of the factors of Fermat numbers*, Art Discrete Appl. Math. (2022).\n-/\n\n@[expose] public section\n\n\nnamespace OeisA358684\n\nopen Nat\n\n/--\nA358684: $a(n)$ is the minimum integer $k$ such that the smallest prime factor of the $n$-th Fermat\nnumber exceeds $2^{2^n - k}$.\nLet $F_n = 2^{2^n} + 1$ be the $n$-th Fermat number, and $P_n$ be its smallest prime factor.\nThe definition of $a(n)$ is equivalent to the closed form:\n$$a(n) = 2^n - \\lfloor \\log_2(P_n) \\rfloor$$\nwhere $P_n = \\operatorname{minFac}(\\operatorname{fermatNumber} n)$.\nThe subtraction is defined in $\\mathbb{N}$ and is safe\n since $P_n \\le F_n$, implying $\\log_2 P_n < 2^n$.\n-/\ndef a (n : ℕ) : ℕ :=\n  letI pn := minFac (fermatNumber n)\n  (2 ^ n) - (log2 pn)\n\n/--\nThe \"original\" definition: $a'(n)$ is the minimum $k$ such that $P_n > 2^{2^n - k}$.\nWe use `Nat.find` which returns the smallest natural number satisfying a predicate.\n-/\nnoncomputable def a' (n : ℕ) : ℕ :=\n  letI Pn := minFac (fermatNumber n)\n  Nat.find (show ∃ k, Pn > 2 ^ (2 ^ n - k) from by\n    use 2^n\n    simp only [tsub_self, pow_zero]\n    simp [Pn]\n    unfold Nat.fermatNumber\n    exact (Nat.minFac_prime (by norm_num)).one_lt\n  )\n\n\n/--\nThe log2 of the smallest prime factor of $F_n$ is at most $2^n$.\n-/\n@[category textbook, AMS 11]\nprivate lemma log2_minFac_le (n : ℕ) : log2 (fermatNumber n).minFac ≤ 2^n := by\n  rw [log2_eq_log_two]\n  refine (log_mono_right (minFac_le (by rw [fermatNumber]; norm_num))).trans_eq ?_\n  rw [fermatNumber, log_eq_of_pow_le_of_lt_pow (le_add_right _ _)]\n  rw [pow_succ, mul_two]\n  gcongr\n  exact one_lt_pow (by norm_num) (by norm_num)\n\n/--\nThe minimization definition is equivalent to the closed form.\n-/\n@[category API, AMS 11]\ntheorem a_equiv_a' (n : ℕ) : a n = a' n := by\n  unfold a a'; set Pn := (fermatNumber n).minFac\n  rw [Eq.comm, Nat.find_eq_iff]\n  constructor\n  · rw [tsub_tsub_cancel_of_le (log2_minFac_le n), log2_eq_log_two]\n    refine lt_of_le_of_ne (pow_log_le_self 2 (Nat.Prime.ne_zero (minFac_prime ?_))) fun h => ?_\n    · rw [fermatNumber]\n      norm_num\n    · have hPn : Pn.Prime := minFac_prime (by rw [fermatNumber]; norm_num)\n      have hnz := log2_eq_log_two ▸ (Nat.log_pos one_lt_two hPn.two_le).ne'\n      refine (Nat.not_even_iff_odd.mpr <| (odd_pow_iff hnz).mp ?_) even_two\n      rw [log2_eq_log_two, h]\n      exact Odd.of_dvd_nat (odd_fermatNumber n) (minFac_dvd _)\n  · intro m hm; simp only [not_lt]\n    rw [lt_tsub_iff_left] at hm\n    rw [log2_eq_log_two] at hm\n    refine (lt_pow_succ_log_self (b:=2) (by norm_num) _).le.trans ?_\n    apply Nat.pow_le_pow_right (by norm_num)\n    apply le_tsub_of_add_le_right\n    have := succ_le_of_lt hm\n    omega\n\n@[category test, AMS 11]\ntheorem a_0 : a 0 = 0 := by norm_num [a]; simp [log2_def]\n\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 0 := by norm_num [a]; simp [log2_def]\n\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 0 := by norm_num [a]; simp [log2_def]\n\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 0 := by\n  unfold a Nat.fermatNumber\n  norm_num\n  decide\n\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 0 := by\n  unfold a Nat.fermatNumber\n  norm_num\n  decide\n\n@[category test, AMS 11]\ntheorem a_5 : a 5 = 23 := by\n  unfold a Nat.fermatNumber\n  norm_num\n  decide\n\n@[category test, AMS 11]\ntheorem a_6 : a 6 = 46 := by\n  decide +native\n\n@[category test, AMS 11]\ntheorem a_7 : a 7 = 73 := by\n  sorry\n\n/--\nConjecture: the dyadic valuation of A93179(n) - 1 does not exceed 2^n - a(n).\n\nA93179(n) is minFac(fermatNumber n), the smallest prime factor of the n-th Fermat number.\nThe conjecture states that if $P_n$ is the smallest prime factor of the $n$-th Fermat number,\nthen $\\nu_2(P_n - 1) \\le 2^n - a(n)$.\nSubstituting the definition of $a(n)$, this is equivalent to $\\nu_2(P_n - 1) \\le \\lfloor \\log_2(P_n) \\rfloor$.\n\nThis is Conjecture 3.4 in [SA22].\n-/\n@[category research solved, AMS 11]\ntheorem oeis_358684_conjecture_0 (n : ℕ) :\n    padicValNat 2 (minFac (fermatNumber n) - 1) ≤ 2 ^ n - a n := by\n  delta fermatNumber and a\n  rw [Nat.sub_sub_self]\n  · rw [Nat.log2_eq_log_two]\n    apply Nat.le_log_of_pow_le (by decide)\n    refine le_trans ?_ <| sub_le _ 1\n    apply Nat.ordProj_le 2\n    exact Nat.sub_ne_zero_of_lt (Nat.minFac_prime (by norm_num)).one_lt\n  · rw [Nat.log2_eq_log_two]\n    have : (2 ^ 2 ^ n) + 1 < 2 ^ ((2 ^ n) + 1) := by\n      simp [pow_add, mul_two]\n    refine Nat.le_of_lt_succ <| (2).log_lt_of_lt_pow ?_ ?_\n    · exact Nat.minFac_pos _|>.ne'\n    · exact (Nat.minFac_le (by bound)).trans_lt this\n\nend OeisA358684\n",
  "statement_hash": "12443a5a3dfe51b9c988a2271f60baa0029ec6c03ff647fa9761834fd33fc730",
  "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."
}