login
A178412
a(n) is defined recursively as the Sum{d|n} ((-1)^(n/d))*a(d) = 1, with a(1) = a(2) = 1.
1
1, 1, -2, 1, -2, -3, -2, 2, 0, -3, -2, -5, -2, -3, 2, 4, -2, 0, -2, -5, 2, -3, -2, -10, 0, -3, 0, -5, -2, 3, -2, 8, 2, -3, 2, 0, -2, -3, 2, -10, -2, 3, -2, -5, 0, -3, -2, -20, 0, 0, 2, -5, -2, 0, 2, -10, 2, -3, -2, 5, -2, -3, 0, 16, 2, 3, -2, -5, 2, 3, -2, 0, -2, -3, 0, -5, 2, 3, -2, -20, 0, -3, -2, 5, 2, -3, 2, -10, -2, 0, 2, -5, 2, -3, 2, -40, -2, 0, 0, 0, -2, 3
OFFSET
1,3
LINKS
FORMULA
If n>=3 is odd squarefree (A056911), then a(n)=2; if n>=6 is even squarefree (A039956), then a(n)=3; if n>=4 has the form (2^k)*m, where k>=2 and m is odd squarefree, then a(n)=n/4 in case of m=1 and a(n)=5*2^(k-2) in case of m>1; if an odd square divides n, then a(n)=0. A generalization. Let A(n)=|B(n)|, where B(1)=f, B(2)=g and, for n>=3, B(n)is defined by the recursion: Sum{d|n}((-1)^(n/d))*B(d)=h. Then we have:if n>=3 is odd squarefree,then A(n)=f+h; if n>=6 is even squarefree,then A(n)=g+2*h; if n>=4 has the form (2^k)*m, where k>=2 and m is odd squarefree, then A(n)=n/4 in case of m=1 and A(n)=(f+g+3*h)*2^(k-2) in case of m>1; if an odd square divides n, then A(n)=0.
EXAMPLE
For n=3, we have Sum{d=1,3}((-1)^(3/d))*b(d)=-1-b(3)=1. Thus b(3)-2 and a(3)=2.
MATHEMATICA
a[1] = a[2] = 1; a[n_] := a[n] = Block[{d = Most@ Divisors@ n}, -1 + Plus @@ (((-1)^(n/#)) a[ # ] & /@ d)]; Array[a, 102] (* Robert G. Wilson v, Aug 26 2010 *)
PROG
(PARI)
up_to = 65537;
A178412list(up_to) = { my(u=vector(up_to)); u[1] = u[2] = 1; for(n=3, up_to, u[n] = sumdiv(n, d, if(d<n, ((-1)^(n/d))*u[d]))-1); (u); };
v178412 = A178412list(up_to);
A178412(n) = v178412[n]; \\ Antti Karttunen, Sep 27 2018
CROSSREFS
Cf. A178411.
Sequence in context: A088062 A248886 A123884 * A182598 A331084 A067694
KEYWORD
sign
AUTHOR
Vladimir Shevelev, May 27 2010
EXTENSIONS
Edited and extended by Robert G. Wilson v, Aug 26 2010
Title changed and terms past a(42) added by Robert G. Wilson v, Aug 26 2010
STATUS
approved