OFFSET
1,2
LINKS
Robert Israel, Table of n, a(n) for n = 1..3223
FORMULA
a(n) = min {k : |Sum_{j=1..k} mu(rad(j))| = n}, where mu is the Moebius function and rad is the squarefree kernel.
MAPLE
N:= 10000: # for values <= N
omega:= n -> nops(numtheory:-factorset(n)):
R:= map(n -> (-1)^omega(n), [$1..10000]):
S:= map(abs, ListTools:-PartialSums(R)):
m:= max(S):
V:= Vector(m):
for i from 1 to N do if S[i] > 0 and V[S[i]] = 0 then V[S[i]]:= i fi od:
convert(V, list); # Robert Israel, Oct 30 2023
MATHEMATICA
Table[k=1; While[Abs[Sum[(-1)^PrimeNu@j, {j, k}]]!=n, k++]; k, {n, 30}] (* Giorgos Kalogeropoulos, Jul 19 2021 *)
PROG
(PARI) a(n) = my(k=1); while (abs(sum(j=1, k, (-1)^omega(j))) != n, k++); k; \\ Michel Marcus, Jul 19 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Ilya Gutkovskiy, Jul 19 2021
STATUS
approved