The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A327666 a(n) = Sum_{k = 1..n} (-1)^(Omega(k) - omega(k)), where Omega(k) counts prime factors of k with multiplicity and omega(k) counts distinct prime factors. 2
1, 2, 3, 2, 3, 4, 5, 6, 5, 6, 7, 6, 7, 8, 9, 8, 9, 8, 9, 8, 9, 10, 11, 12, 11, 12, 13, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 26, 25, 26, 27, 26, 25, 24, 25, 24, 25, 26, 27, 28, 29, 30, 31, 30, 31, 32, 31, 30, 31, 32, 33, 32, 33, 34 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Partial sums of A162511.
LINKS
FORMULA
a(1) = 1, a(n) = a(n - 1) + (-1)^(Omega(n) - omega(n)) for n > 1.
a(n) ~ c * n, where c = A307868. - Amiram Eldar, Sep 18 2022
EXAMPLE
Omega(1) = omega(1) = 0. The difference is 0, so (-1)^0 = 1, so a(1) = 1.
Omega(2) = omega(2) = 1. The difference is 0, so (-1)^0 = 1, which is added to a(1) to give a(2) = 2.
Omega(3) = omega(3) = 1. The difference is 0, so (-1)^0 = 1, which is added to a(2) to give a(3) = 3.
Omega(4) = 2 but omega(4) = 1. The difference is 1, so (-1)^1 = -1, which is added to a(3) to give a(4) = 2.
MATHEMATICA
Table[Sum[(-1)^(PrimeOmega[k] - PrimeNu[k]), {k, n}], {n, 70}]
f[p_, e_] := (-1)^(e - 1); Accumulate @ Table[Times @@ f @@@ FactorInteger[n], {n, 1, 100}] (* Amiram Eldar, Sep 18 2022 *)
PROG
(PARI) seq(n)={my(v=vector(n)); v[1]=1; for(k=2, n, v[k] = v[k-1] + (-1)^(bigomega(k)-omega(k))); v} \\ Andrew Howroyd, Sep 23 2019
(Python)
from functools import reduce
from sympy import factorint
def A327666(n): return sum(-1 if reduce(lambda a, b:~(a^b), factorint(i).values(), 0)&1 else 1 for i in range(1, n+1)) # Chai Wah Wu, Jan 01 2023
CROSSREFS
Sequence in context: A289172 A215653 A358503 * A286717 A162751 A026342
KEYWORD
nonn
AUTHOR
Ilya Gutkovskiy, Sep 21 2019
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 14 00:47 EDT 2024. Contains 372528 sequences. (Running on oeis4.)