A076544 a(n) = mu(n) + sqf(n) where mu(n) is Moebius function, sqf(n) = 1 if n is squarefree and sqf(n) = -1 otherwise.
2, 0, 0, -1, 0, 2, 0, -1, -1, 2, 0, -1, 0, 2, 2, -1, 0, -1, 0, -1, 2, 2, 0, -1, -1, 2, -1, -1, 0, 0, 0, -1, 2, 2, 2, -1, 0, 2, 2, -1, 0, 0, 0, -1, -1, 2, 0, -1, -1, -1, 2, -1, 0, -1, 2, -1, 2, 2, 0, -1, 0, 2, -1, -1, 2, 0, 0, -1, 2, 0, 0, -1, 0, 2, -1, -1, 2, 0, 0, -1, -1, 2, 0, -1, 2, 2, 2, -1, 0, -1, 2, -1, 2, 2, 2, -1, 0, -1, -1, -1
Offset: 1
Links
Programs
-
Mathematica
ms[n_]:=MoebiusMu[n]+If[SquareFreeQ[n],1,-1]; Array[ms,100] (* Harvey P. Dale, Feb 22 2013 *)
-
PARI
a(n) = {my(m = moebius(n)); 2 * m^2 + m - 1;} \\ Amiram Eldar, May 28 2025
-
Scheme
(define (A076544 n) (+ (A008683 n) (expt -1 (+ 1 (abs (A008683 n)))))) ;; Antti Karttunen, Jul 26 2017
Formula
a(n) = mu(n) + -1^(1+abs(mu(n))), where mu(n) = A008683(n). - Antti Karttunen, Jul 26 2017
From Amiram Eldar, May 28 2025: (Start)
a(n) = 2*mu(n)^2 + mu(n) - 1, where mu(n) = A008683(n).
Asymptotic mean: lim_{m->oo} (1/m) * Sum_{k=1..m} = 12/Pi^2 - 1. (End)