This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A327666 #21 Jan 01 2023 11:16:27 %S A327666 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, %T A327666 15,16,17,18,19,20,21,22,23,24,25,26,27,26,25,26,27,26,25,24,25,24,25, %U A327666 26,27,28,29,30,31,30,31,32,31,30,31,32,33,32,33,34 %N 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. %C A327666 Partial sums of A162511. %H A327666 Amiram Eldar, <a href="/A327666/b327666.txt">Table of n, a(n) for n = 1..10000</a> %F A327666 a(1) = 1, a(n) = a(n - 1) + (-1)^(Omega(n) - omega(n)) for n > 1. %F A327666 a(n) ~ c * n, where c = A307868. - _Amiram Eldar_, Sep 18 2022 %e A327666 Omega(1) = omega(1) = 0. The difference is 0, so (-1)^0 = 1, so a(1) = 1. %e A327666 Omega(2) = omega(2) = 1. The difference is 0, so (-1)^0 = 1, which is added to a(1) to give a(2) = 2. %e A327666 Omega(3) = omega(3) = 1. The difference is 0, so (-1)^0 = 1, which is added to a(2) to give a(3) = 3. %e A327666 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. %t A327666 Table[Sum[(-1)^(PrimeOmega[k] - PrimeNu[k]), {k, n}], {n, 70}] %t A327666 f[p_, e_] := (-1)^(e - 1); Accumulate @ Table[Times @@ f @@@ FactorInteger[n], {n, 1, 100}] (* _Amiram Eldar_, Sep 18 2022 *) %o A327666 (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 %o A327666 (Python) %o A327666 from functools import reduce %o A327666 from sympy import factorint %o A327666 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 %Y A327666 Cf. A001221, A001222, A002321, A002819, A008836, A046660, A069812, A076479, A162511, A174863, A307868. %K A327666 nonn %O A327666 1,2 %A A327666 _Ilya Gutkovskiy_, Sep 21 2019