[go: up one dir, main page]

login
a(n) is the smallest number k such that |Sum_{j=1..k} (-1)^omega(j)| = n, where omega(j) is the number of distinct primes dividing j.
3

%I #16 Oct 31 2023 01:08:08

%S 1,4,5,8,9,32,77,88,93,94,95,96,99,100,119,124,147,148,161,162,189,

%T 206,207,208,209,210,213,214,215,216,217,218,219,226,329,330,333,334,

%U 335,394,395,416,417,424,425,428,489,514,515,544,545,546,549,554,579,584,723,724,725,800

%N a(n) is the smallest number k such that |Sum_{j=1..k} (-1)^omega(j)| = n, where omega(j) is the number of distinct primes dividing j.

%H Robert Israel, <a href="/A346457/b346457.txt">Table of n, a(n) for n = 1..3223</a>

%F a(n) = min {k : |Sum_{j=1..k} mu(rad(j))| = n}, where mu is the Moebius function and rad is the squarefree kernel.

%p N:= 10000: # for values <= N

%p omega:= n -> nops(numtheory:-factorset(n)):

%p R:= map(n -> (-1)^omega(n),[$1..10000]):

%p S:= map(abs,ListTools:-PartialSums(R)):

%p m:= max(S):

%p V:= Vector(m):

%p for i from 1 to N do if S[i] > 0 and V[S[i]] = 0 then V[S[i]]:= i fi od:

%p convert(V,list); # _Robert Israel_, Oct 30 2023

%t Table[k=1;While[Abs[Sum[(-1)^PrimeNu@j,{j,k}]]!=n,k++];k,{n,30}] (* _Giorgos Kalogeropoulos_, Jul 19 2021 *)

%o (PARI) a(n) = my(k=1); while (abs(sum(j=1, k, (-1)^omega(j))) != n, k++); k; \\ _Michel Marcus_, Jul 19 2021

%Y Cf. A001221, A002053, A051400, A051401, A051402, A051470, A060434, A076479, A174863, A275547, A346455, A346456.

%K nonn

%O 1,2

%A _Ilya Gutkovskiy_, Jul 19 2021