{
  "id": "4914",
  "ident": "NS.04914",
  "slug": "oeis-129365--conjecture2",
  "title": "Ratio of product of GCDs to product of factorials of floor divisions · conjecture2",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "Conjecture (2): If $p$ is a prime, then $p \\mid a(n)$ if and only if $p \\le n/3$.\n\nProof summary:\n\nWe use the formula shown above:\n$\\textrm{ord}(a(n), p) = \\sum_{r \\geq 1} b(\\lfloor n/p^r \\rfloor)$ where\n$b(m) = \\sum_{k=1}^m m \\textrm{ mod } k$.\n\nIf $p ∣ a(n)$ then $b(\\lfloor n/p^r \\rfloor) ≥ 1$ for some $r ≥ 1$. Since b(m) = 0$ for $m \\leq 2$,\nwe must have $n / p^r \\geq 3$. If the inequality holds for $r \\geq 1$, it must be true for $r = 1$.\nHence $n \\geq 3p$, proving the conjecture.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "formal_proof"
  ],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA129365.conjecture2",
  "statement_lean": "theorem conjecture2 (n p : ℕ) (hn : 0 < n) (hp : p.Prime) :\n    (∃ m : ℕ, a n = m ∧ p ∣ m) ↔ p ≤ n / 3",
  "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# Ratio of product of GCDs to product of factorials of floor divisions\n\n$$a(n) = \\frac{\\prod_{j=1}^n \\prod_{k=1}^n \\gcd(j,k)}{\\prod_{k=1}^n (\\lfloor n/k \\rfloor!)^k}$$\n\n*References:*\n- [A129365](https://oeis.org/A129365)\n-/\n\n@[expose] public section\n\nnamespace OeisA129365\n\n/-- $a(n) = \\frac{\\prod_{j=1}^n \\prod_{k=1}^n \\gcd(j,k)}{\\prod_{k=1}^n (\\lfloor n/k \\rfloor!)^k}$. -/\ndef a (n : ℕ) : ℚ :=\n  let num : ℚ := (Finset.Icc 1 n).prod fun j => (Finset.Icc 1 n).prod fun k => Nat.gcd j k\n  let den : ℚ := (Finset.Icc 1 n).prod fun k => (n / k).factorial ^ k\n  num / den\n\n/-- Sequence A004125: sum of remainders $n \\bmod k$ for $1 \\le k \\le n$. -/\ndef b (n : ℕ) : ℕ :=\n  ∑ k ∈ Finset.Icc 1 n, (n % k)\n\n/-- Value of the sequence `a` at 0. -/\n@[category test, AMS 11]\ntheorem a_0 : a 0 = 1 := by decide +native\n\n/-- Value of the sequence `a` at 1. -/\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 1 := by decide +native\n\n/-- Value of the sequence `a` at 2. -/\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 1 := by decide +native\n\n/-- Value of the sequence `a` at 3. -/\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 1 := by decide +native\n\n/-- Value of the sequence `a` at 4. -/\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 1 := by decide +native\n\nset_option linter.style.formal_proof_palomar false in\n/--\nConjecture (1): $a(n)$ is always an integer (the denominator divides the numerator).\n\nProof summary:\n\nLet $c(n) = \\prod_{j=1}^n \\prod_{k=1}^n (j,k)$ be the numerator.\nObserve that\n$$\\textrm{ord}(c(n), p) = \\left\\lfloor \\frac{n}{p} \\right\\rfloor^2 + \\left\\lfloor \\frac{n}{p^2} \\right\\rfloor^2 + ...$$\nproven similar to Legendre's formula for $\\textrm{ord}(n!, p)$.\n\nNext let $d(n) = \\prod_{k=1}^n (\\lfloor n/k \\rfloor!)^k$ be the denominator.\nObserve that\n$$\\textrm{ord}(d(n), p) = \\sum_{k=1}^n k\\,\\textrm{ord}(\\lfloor n/k \\rfloor, p) = \\sum_{k=1}^n \\sum_{r \\geq 1} k \\left\\lfloor \\frac{\\lfloor n/p^r \\rfloor}{k} \\right\\rfloor.$$\n\nCombining the two gives:\n$$\\textrm{ord}(a(n), p) = \\sum_{r \\geq 1} \\sum_{k=1}^n \\left(\\left\\lfloor \\frac{n}{p^r} \\right\\rfloor \\textrm{mod } k\\right).$$\n\nDefining $b(m) = \\sum_{k=1}^m m \\textrm{ mod } k$, we obtain $\\textrm{ord}(a(n), p) = \\sum_{r \\geq 1} b(\\lfloor n/p^r \\rfloor)$.\n\nAs $b(m) \\geq 0$, $\\textrm{ord}(a(n), p)$ is non-negative for any $p$, so $a(n)$ is an integer.\n-/\n@[category research solved, AMS 11,\n  formal_proof using lean4 at\n    \"https://github.com/KitaKen1/oeis-a129365-conjectures/blob/9c0201540c337733d6b8afb2aff209f5489c122a/lean/OeisA129365FC.lean#L234-L395\"]\ntheorem conjecture1 (n : ℕ) (hn : 0 < n) :\n    ((Finset.Icc 1 n).prod fun k => (n / k).factorial ^ k) ∣\n      ((Finset.Icc 1 n).prod fun j => (Finset.Icc 1 n).prod fun k => Nat.gcd j k) := by\n  sorry\n\nset_option linter.style.formal_proof_palomar false in\n/--\nConjecture (2): If $p$ is a prime, then $p \\mid a(n)$ if and only if $p \\le n/3$.\n\nProof summary:\n\nWe use the formula shown above:\n$\\textrm{ord}(a(n), p) = \\sum_{r \\geq 1} b(\\lfloor n/p^r \\rfloor)$ where\n$b(m) = \\sum_{k=1}^m m \\textrm{ mod } k$.\n\nIf $p ∣ a(n)$ then $b(\\lfloor n/p^r \\rfloor) ≥ 1$ for some $r ≥ 1$. Since b(m) = 0$ for $m \\leq 2$,\nwe must have $n / p^r \\geq 3$. If the inequality holds for $r \\geq 1$, it must be true for $r = 1$.\nHence $n \\geq 3p$, proving the conjecture.\n-/\n@[category research solved, AMS 11,\n  formal_proof using lean4 at\n    \"https://github.com/KitaKen1/oeis-a129365-conjectures/blob/9c0201540c337733d6b8afb2aff209f5489c122a/lean/OeisA129365FC.lean#L234-L395\"]\ntheorem conjecture2 (n p : ℕ) (hn : 0 < n) (hp : p.Prime) :\n    (∃ m : ℕ, a n = m ∧ p ∣ m) ↔ p ≤ n / 3 := by\n  sorry\n\nset_option linter.style.formal_proof_palomar false in\n/--\nConjecture (3): For each positive integer $n$, prime $p$, and $0 \\le k < p$,\n$\\mathrm{ord}_p(a(np)) = \\mathrm{ord}_p(a(np + k))$.\n\nProof summary:\n\nThis follows from the formula shown above:\n$\\textrm{ord}(a(n), p) = \\sum_{r \\geq 1} b(\\lfloor n/p^r \\rfloor)$ where\n$b(m) = \\sum_{k=1}^m m \\textrm{ mod } k$.\n\nSince $k < p$, we have $\\lfloor (np + k)/p^r \\rfloor = \\lfloor np/p^r \\rfloor$ for every $r \\geq 1$,\nproving the claim.\n-/\n@[category research solved, AMS 11,\n  formal_proof using lean4 at\n    \"https://github.com/KitaKen1/oeis-a129365-conjectures/blob/9c0201540c337733d6b8afb2aff209f5489c122a/lean/OeisA129365FC.lean#L234-L395\"]\ntheorem conjecture3 (n p k : ℕ) (hn : 0 < n) (hp : p.Prime) (hk : k < p) :\n    padicValRat p (a (n * p)) = padicValRat p (a (n * p + k)) := by\n  sorry\n\nset_option linter.style.formal_proof_palomar false in\n/--\nConjecture (4): Let $b(n) = \\mathrm{A004125}(n) = \\sum_{k=1}^n (n \\bmod k)$. Then\n$\\mathrm{ord}_p(a(np)) = \\sum_{i \\ge 0} b(\\lfloor n/p^i \\rfloor)$.\n\nProof summary:\n\nThis follows directly from the formula shown at the beginning:\n$\\textrm{ord}(a(n), p) = \\sum_{r \\geq 1} b(\\lfloor n/p^r \\rfloor)$ where\n$b(m) = \\sum_{k=1}^m m \\textrm{ mod } k$.\n-/\n@[category research solved, AMS 11,\n  formal_proof using lean4 at\n    \"https://github.com/KitaKen1/oeis-a129365-conjectures/blob/9c0201540c337733d6b8afb2aff209f5489c122a/lean/OeisA129365FC.lean#L234-L395\"]\ntheorem conjecture4 (n p : ℕ) (hn : 0 < n) (hp : p.Prime) :\n    padicValRat p (a (n * p)) = ∑' i : ℕ, (b (n / p ^ i) : ℤ) := by\n  sorry\n\nend OeisA129365\n",
  "statement_hash": "b0cca385e5013c55d5bd5e7fc857731c859e27a6ea0662399874beec964c5a74",
  "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."
}