login
A178411
a(1)=2, a(2)=1; for n>=3, a(n) is defined by recursion: Sum_{d|n}((-1)^(n/d))*a(d) = -1.
2
2, 1, -1, 4, -1, 1, -1, 8, 0, 1, -1, 0, -1, 1, 1, 16, -1, 0, -1, 0, 1, 1, -1, 0, 0, 1, 0, 0, -1, -1, -1, 32, 1, 1, 1, 0, -1, 1, 1, 0, -1, -1, -1, 0, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 1, 0, 1, 1, -1, 0, -1, 1, 0, 64, 1, -1, -1, 0, 1, -1, -1, 0, -1, 1, 0, 0, 1, -1, -1, 0, 0, 1, -1, 0, 1, 1, 1, 0, -1, 0, 1, 0, 1, 1, 1, 0, -1, 0, 0, 0, -1, -1, -1, 0, -1
OFFSET
1,1
COMMENTS
A generalization of the sequence: Let a(1) = m+1, a(2) = 2*m-1, and for n>=3, a(n) is defined by recursion: Sum{d|n}((-1)^(n/d))*a(d) = -m. Then a(n) = mu(n), if n is not power of 2; otherwise, for n>=4, a(n) = m*n.
LINKS
FORMULA
a(1) = 2, a(2) = 1, and for n > 2, if A209229(n) = 1 [n is a power of 2] then a(n) = n, otherwise a(n) = A008683(n), where A008683(n) is Moebius mu function.
a(n) = 1 + Sum_{d|n, d<n} ((-1)^(n/d))*a(d). [Description converted from an implicit to an explicit recurrence] - Antti Karttunen, Sep 21 2017
MATHEMATICA
a[1] = 2; a[2] = 1; a[n_] := a[n] = If[IntegerQ@ Log2@ n, # + 1, MoebiusMu[n]] &@ Sum[((-1)^(n/d)) a[d], {d, Most@ Divisors@ n}]; Array[a, 105] (* Michael De Vlieger, Sep 21 2017 *)
PROG
(PARI) A178411(n) = { my(s=1); if(n<=2, 3-n, fordiv(n, d, if(d<n, s+=(((-1)^(n/d))*A178411(d)))); s); }; \\ Antti Karttunen, Sep 21 2017
CROSSREFS
Sequence in context: A136674 A144383 A205553 * A257598 A294580 A294587
KEYWORD
sign
AUTHOR
Vladimir Shevelev, May 27 2010
EXTENSIONS
More terms and editing from Antti Karttunen, Sep 21 2017
STATUS
approved