login
a(1) = a(2) = 1; for n > 2, a(n+2) = Sum_{d|n} mu(n/d)*a(d).
6

%I #19 May 15 2019 08:33:49

%S 1,1,1,0,0,-1,-1,-2,-2,-2,-3,-2,-4,0,-5,1,-5,3,-6,7,-7,10,-6,13,-7,17,

%T -7,21,-5,22,-6,31,-7,30,-4,35,-2,33,-3,39,1,34,0,42,-1,33,7,39,6,23,

%U 7,32,12,16,11,18,15,-1,21,4,20,-27,19,-21,29,-52,34,-56,33,-85,39,-80,38,-130,37

%N a(1) = a(2) = 1; for n > 2, a(n+2) = Sum_{d|n} mu(n/d)*a(d).

%H Antti Karttunen, <a href="/A318583/b318583.txt">Table of n, a(n) for n = 1..16384</a>

%H N. J. A. Sloane, <a href="/transforms.txt">Transforms</a>

%F G.f.: Sum_{n>=1} a(n+2)*x^n/(1 - x^n).

%F L.g.f.: -log(Product_{n>=1} (1 - x^n)^(a(n+2)/n)) = Sum_{n>=1} a(n)*x^n/n.

%p with(numtheory): P:=proc(q) local k,n,x; x:=[1,1]: for n from 3 to q do

%p x:=[op(x),add(mobius((n-2)/k)*x[k],k=divisors(n-2))]; od; op(x); end:

%p P(75); # _Paolo P. Lava_, May 15 2019

%t a[1] = a[2] = 1; a[n_] := a[n] = Sum[a[d] MoebiusMu[(n - 2)/d], {d, Divisors[n - 2]}]; Table[a[n], {n, 75}]

%o (PARI) A318583(n) = if(n<=2,1,sumdiv(n-2,d,moebius((n-2)/d)*A318583(d))); \\ (A non-memoized implementation) - _Antti Karttunen_, Aug 29 2018

%o (PARI)

%o \\ A faster implementation:

%o up_to = 16384;

%o A318583list(up_to) = { my(u=vector(up_to)); u[1] = u[2] = 1; for(n=3, up_to, u[n] = sumdiv(n-2,d,moebius((n-2)/d)*u[d])); (u); };

%o v318583 = A318583list(up_to);

%o A318583(n) = v318583[n]; \\ _Antti Karttunen_, Aug 29 2018

%Y Cf. A007439, A007554, A008683.

%K sign,look

%O 1,8

%A _Ilya Gutkovskiy_, Aug 29 2018