{
  "id": "6217",
  "ident": "NS.06217",
  "slug": "oeis-317940",
  "title": "Nonnegativity of the Dirichlet square root of A046644",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "\"No negative terms among the first 2^20 terms. Is the sequence nonnegative?\"\n\nEquivalently, the rational Dirichlet square root `f` is nonnegative at every\npositive index. Informally, the proof constructs a strictly positive\nmultiplicative square root prime-power by prime-power using formal power\nseries, and then identifies it with the recursively defined sequence `f`.\n\nThe proof was obtained by exploiting the multiplicativity of A046644 and\nreducing the problem to its values on prime powers. The resulting convolution\nrecurrence for the prime-power coefficients was recognized as a\nformal-power-series identity. A positive coefficient sequence was constructed\nthrough a differential equation for the generating series, extended\nmultiplicatively to all positive integers, and finally identified with the\nrecursively defined Dirichlet square root by uniqueness.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "formal_proof"
  ],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA317940.f_nonnegative",
  "statement_lean": "theorem f_nonnegative (n : ℕ) (h : n > 0) : f n ≥ 0",
  "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# Nonnegativity of the Dirichlet square root of A046644\n\nA317940 is the integer sequence whose value `a n` is the numerator of the\nrational sequence `f n`, where the Dirichlet convolution square of `f` is\nA046644. The auxiliary sequence A046644 is multiplicative and takes the value\n$2^{\\operatorname{A005187}(e)}$ on a prime power $p^e$.\n\nThe conjecture asks whether `f n` is nonnegative for every positive `n`.\nThe proof reduces the problem to prime powers and constructs positive rational\ncoefficients $c(e)$ satisfying\n\n$$\\sum_{i=0}^e c(i)c(e-i)=2^{\\operatorname{A005187}(e)}.$$\n\nThe coefficients are obtained from formal power series. A positive series\n$A$ is defined by the first-order differential equation\n$A' = \\frac12 D A$. A second explicitly defined series $B$ satisfies\n$B' = D B$ and has the same constant term as $A^2$; uniqueness of the\ncoefficient recurrence therefore gives $A^2=B$. After rescaling the\ncoefficients by $4^e$, this becomes the displayed prime-power convolution\nidentity.\n\nExtending $c(e)$ multiplicatively over prime factorizations gives a positive\narithmetic function `root` with `root * root = a046644`. Finally, the recursive\ndefinition of `f` is shown to be the unique Dirichlet square root with value\none at $1$, so `f = root` and every positive-index value of `f` is positive.\n\nThis route was found by first exploiting the multiplicativity recorded in the\nOEIS entry, reducing the recurrence to the exponent of a single prime, and\nthen recognizing the resulting coefficient identities as a formal-power-series\ndifferential equation.\n\n*References:*\n- [A317940](https://oeis.org/A317940)\n- [A046644](https://oeis.org/A046644)\n- [A005187](https://oeis.org/A005187)\n-/\n\n@[expose] public section\n\nnamespace OeisA317940\n\nopen Nat Finset\n\n/--\nA005187: the sum of $\\lfloor e / 2^k \\rfloor$ over $k \\ge 0$.\n-/\nnoncomputable def a005187 (e : ℕ) : ℕ :=\n  Finset.sum (Finset.range (e + 1)) fun k ↦ e / (2 ^ k)\n\n/--\nA046644: the multiplicative function whose value at each prime power $p^e$ is\n$2^{\\operatorname{A005187}(e)}$.\n-/\nnoncomputable def a046644 (n : ℕ) : ℚ :=\n  if n = 0 then 0\n  else n.factorization.prod fun _ e ↦ (2 : ℚ) ^ (a005187 e)\n\n/--\nThe rational sequence whose Dirichlet convolution square is A046644, written\nusing the defining recurrence from the OEIS entry.\n-/\nnoncomputable def f : ℕ → ℚ :=\n  WellFounded.fix (measure id).wf fun n IH ↦\n    if n = 0 then 0\n    else if n = 1 then 1\n    else\n      let target : ℚ := a046644 n\n      let interiorSum : ℚ := Finset.sum (divisors n) fun d ↦\n        if h : d > 1 ∧ d < n then\n          have d_lt_n : d < n := h.2\n          let q := n / d\n          have q_lt_n : q < n := Nat.div_lt_self (Nat.pos_of_ne_zero (by omega)) h.1\n          IH d d_lt_n * IH q q_lt_n\n        else 0\n      (target - interiorSum) / 2\n\n/--\nA317940: the numerator of `f n`.\n-/\nnoncomputable def a (n : ℕ) : ℤ :=\n  (f n).num\n\n/-- The defining recurrence of `f`, with the recursive calls folded back to `f`. -/\n@[category API, AMS 11]\nprivate lemma f_eq (n : ℕ) :\n    f n = if n = 0 then 0 else if n = 1 then 1 else\n      (a046644 n -\n        ∑ d ∈ n.divisors, if _h : 1 < d ∧ d < n then f d * f (n / d) else 0) / 2 := by\n  conv_lhs => rw [f, WellFounded.fix_eq]\n  rfl\n\n@[category API, AMS 11]\nprivate lemma f_one : f 1 = 1 := by\n  rw [f_eq]; norm_num\n\n/-- At a prime `p` every divisor is `1` or `p`, so the interior sum is empty. -/\n@[category API, AMS 11]\nprivate lemma f_prime {p : ℕ} (hp : p.Prime) : f p = a046644 p / 2 := by\n  rw [f_eq, if_neg hp.ne_zero, if_neg hp.ne_one,\n    Finset.sum_eq_zero (fun x hx => ?_)]\n  · ring\n  · rcases hp.eq_one_or_self_of_dvd x (Nat.mem_divisors.mp hx).1 with rfl | rfl\n    · exact dif_neg (by omega)\n    · exact dif_neg (by omega)\n\n@[category API, AMS 11]\nprivate lemma f_two : f 2 = 1 := by\n  rw [f_prime Nat.prime_two]; norm_num [a046644, a005187]\n\n@[category API, AMS 11]\nprivate lemma f_three : f 3 = 1 := by\n  rw [f_prime Nat.prime_three]; norm_num [a046644, a005187]\n\n@[category API, AMS 11]\nprivate lemma f_five : f 5 = 1 := by\n  rw [f_prime (by norm_num)]; norm_num [a046644, a005187]\n\n/-- `4 = 2 ^ 2` is the only case here with a nonempty interior sum, contributing `f 2 * f 2`. -/\n@[category API, AMS 11]\nprivate lemma f_four : f 4 = 7 / 2 := by\n  rw [f_eq 4]\n  norm_num only\n  rw [show (Nat.divisors 4) = {1, 2, 4} from rfl,\n    Finset.sum_insert (by decide), Finset.sum_insert (by decide), Finset.sum_singleton,\n    dif_neg (by omega), dif_pos (by omega), dif_neg (by omega),\n    show a046644 4 = 8 from ?_]\n  · rw [f_two]; norm_num\n  · rw [a046644, if_neg (by norm_num), show (4 : ℕ) = 2 ^ 2 by norm_num,\n      Nat.Prime.factorization_pow Nat.prime_two]\n    norm_num [Finsupp.prod_single_index, a005187, Finset.sum_range_succ]\n\n/-- `f 1 = 1` is the base case of the recurrence, so `a 1 = 1`. -/\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 1 := by\n  rw [a, f_one]\n  rfl\n\n/-- `2` is prime, so the interior sum is empty and `f 2 = a046644 2 / 2 = 1`. -/\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 1 := by\n  rw [a, f_two]\n  rfl\n\n/-- `3` is prime, so the interior sum is empty and `f 3 = a046644 3 / 2 = 1`. -/\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 1 := by\n  rw [a, f_three]\n  rfl\n\n/-- `4` is the first index with a nonempty interior sum, giving `f 4 = 7 / 2`. -/\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 7 := by\n  rw [a, f_four]\n  norm_num\n\n/-- `5` is prime, so the interior sum is empty and `f 5 = a046644 5 / 2 = 1`. -/\n@[category test, AMS 11]\ntheorem a_5 : a 5 = 1 := by\n  rw [a, f_five]\n  rfl\n\nset_option linter.style.formal_proof_palomar false in\n/--\n\"No negative terms among the first 2^20 terms. Is the sequence nonnegative?\"\n\nEquivalently, the rational Dirichlet square root `f` is nonnegative at every\npositive index. Informally, the proof constructs a strictly positive\nmultiplicative square root prime-power by prime-power using formal power\nseries, and then identifies it with the recursively defined sequence `f`.\n\nThe proof was obtained by exploiting the multiplicativity of A046644 and\nreducing the problem to its values on prime powers. The resulting convolution\nrecurrence for the prime-power coefficients was recognized as a\nformal-power-series identity. A positive coefficient sequence was constructed\nthrough a differential equation for the generating series, extended\nmultiplicatively to all positive integers, and finally identified with the\nrecursively defined Dirichlet square root by uniqueness.\n-/\n@[category research solved, AMS 11,\n  formal_proof using lean4 at\n    \"https://domthedeveloper.github.io/crl/math/a317940/proof/A317940_verified.lean\"]\ntheorem f_nonnegative (n : ℕ) (h : n > 0) : f n ≥ 0 := by\n  sorry\n\nend OeisA317940",
  "statement_hash": "39c56c5fd6e3eaa66a634df32846c66c63df976fcbad5479ca5209d681cdf88b",
  "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."
}