OFFSET
1,1
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..10000
FORMULA
a(n) is multiplicative with a(2^e) = a(3^e) = -1 if e=1, 0 if e>1, a(p^e) = (-1)^e if p > 3.
a(4*n) = a(9*n) = 0.
Dirichlet g.f.: (zeta(2*s)/zeta(s)) * (1 - 2^(-2*s)) * (1 - 3^(-2*s)). - Amiram Eldar, Oct 28 2023
EXAMPLE
G.f. = x - x^2 - x^3 - x^5 + x^6 - x^7 + x^10 - x^11 - x^13 + x^14 + x^15 + ...
MATHEMATICA
a[ n_] := If[ n < 1, 0, Times @@ (Which[# == 1, 1, # < 5, -Boole[#2 == 1], True, (-1)^#2] & @@@ FactorInteger @ n)]; (* Michael Somos, Oct 31 2015 *)
PROG
(PARI) {a(n) = my(A, p, e); if( n<1, 0, A = factor(n); prod(k = 1, matsize(A)[1], [p, e] = A[k, ]; if(p < 5, -(e==1), (-1)^e )))};
(Scheme, with memoization-macro definec) (definec (A133639 n) (cond ((= 1 n) n) ((zero? (modulo n 4)) 0) ((zero? (modulo n 9)) 0) ((even? n) (- (A133639 (/ n 2)))) ((zero? (modulo n 3)) (- (A133639 (/ n 3)))) (else (- (A133639 (A032742 n)))))) ;; (For the code of A032742, see under that entry) Antti Karttunen, Sep 23 2017
CROSSREFS
KEYWORD
sign,easy,mult
AUTHOR
Michael Somos, Sep 14 2007
STATUS
approved