/- Copyright 2026 The Formal Conjectures Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -/ module public import FormalConjecturesUtil

Partial sums of $(-1)^{k - \Omega(k)}$

The sequence $a(n) = \sum_{k=1}^n (-1)^{k - \Omega(k)}$, where $\Omega(k)$ is the total number of prime factors of $k$ counted with multiplicity.

References:

@[expose] public sectionnamespace OeisA212496open scoped ArithmeticFunction.Omega

$a(n) = \sum_{k=1}^n (-1)^{k - \Omega(k)}$.

def a (n : ℕ) : ℤ := ∑ k ∈ Finset.Icc 1 n, if (k + Ω k) % 2 = 0 then 1 else -1@[category test, AMS 11] theorem a_1 : a 1 = -1 := ⊢ a 1 = -1 ⊢ (∑ k ∈ Finset.Icc 1 1, if (k + k.primeFactorsList.length) % 2 = 0 then 1 else -1) = -1; All goals completed! 🐙@[category test, AMS 11] theorem a_2 : a 2 = -2 := ⊢ a 2 = -2 ⊢ (∑ k ∈ Finset.Icc 1 2, if (k + k.primeFactorsList.length) % 2 = 0 then 1 else -1) = -2; All goals completed! 🐙@[category test, AMS 11] theorem a_3 : a 3 = -1 := ⊢ a 3 = -1 ⊢ (∑ k ∈ Finset.Icc 1 3, if (k + k.primeFactorsList.length) % 2 = 0 then 1 else -1) = -1; All goals completed! 🐙@[category test, AMS 11] theorem a_4 : a 4 = 0 := ⊢ a 4 = 0 ⊢ (∑ k ∈ Finset.Icc 1 4, if (k + k.primeFactorsList.length) % 2 = 0 then 1 else -1) = 0; All goals completed! 🐙@[category test, AMS 11] theorem a_5 : a 5 = 1 := ⊢ a 5 = 1 ⊢ (∑ k ∈ Finset.Icc 1 5, if (k + k.primeFactorsList.length) % 2 = 0 then 1 else -1) = 1; All goals completed! 🐙

Auxiliary sequence $b(n) = \sum_{k=1}^n \frac{(-1)^{k - \Omega(k)}}{k}$.

def b (n : ℕ) : ℚ := ∑ k ∈ Finset.Icc 1 n, (if (k + Ω k) % 2 = 0 then (1 : ℚ) else -1) / (k : ℚ)

"On May 16 2012, Zhi-Wei Sun conjectured that $a(n)$ is positive for each $n > 4$."

    Zhi-Wei Sun, May 19 2012

@[category research open, AMS 11] theorem conjecture_1 (n : ℕ) (hn : 4 < n) : 0 < a n := n:ℕhn:4 < n⊢ 0 < a n All goals completed! 🐙

"Moreover, he guessed that $a(n) > \sqrt{n}$ for any $n > 324$."

    Zhi-Wei Sun, May 19 2012

@[category research open, AMS 11] theorem conjecture_2 (n : ℕ) (hn : 324 < n) : Real.sqrt (n : ℝ) < (a n : ℝ) := n:ℕhn:324 < n⊢ √↑n < ↑(a n) All goals completed! 🐙

"He also guessed that $a(n) < \sqrt{n}\log(\log(n))$ for $n > 5892$."

    Zhi-Wei Sun, May 19 2012

@[category research open, AMS 11] theorem conjecture_3 (n : ℕ) (hn : 5892 < n) : (a n : ℝ) < Real.sqrt (n : ℝ) * Real.log (Real.log (n : ℝ)) := n:ℕhn:5892 < n⊢ ↑(a n) < √↑n * Real.log (Real.log ↑n) All goals completed! 🐙

"Sun also conjectured that $b(n) = \sum_{k=1}^n (-1)^{k-\Omega(k)}/k < 0$ for all $n=1,2,3,\dots$"

    Zhi-Wei Sun, May 19 2012

@[category research open, AMS 11] theorem conjecture_4 (n : ℕ) (hn : 0 < n) : b n < 0 := n:ℕhn:0 < n⊢ b n < 0 All goals completed! 🐙

"Moreover, he guessed that $b(n) < -1/\sqrt{n}$ for all $n > 1$."

    Zhi-Wei Sun, May 19 2012

@[category research open, AMS 11] theorem conjecture_5 (n : ℕ) (hn : 1 < n) : (b n : ℝ) < -1 / Real.sqrt (n : ℝ) := n:ℕhn:1 < n⊢ ↑(b n) < -1 / √↑n All goals completed! 🐙

"He also guessed that $b(n) > -\log(\log(n))/\sqrt{n}$ for $n > 2008$."

    Zhi-Wei Sun, May 19 2012

@[category research open, AMS 11] theorem conjecture_6 (n : ℕ) (hn : 2008 < n) : -Real.log (Real.log (n : ℝ)) / Real.sqrt (n : ℝ) < (b n : ℝ) := n:ℕhn:2008 < n⊢ -Real.log (Real.log ↑n) / √↑n < ↑(b n) All goals completed! 🐙end OeisA212496