login
A344373
a(n) = Sum_{k=1..n-1} (-1)^k gcd(k, n).
5
0, -1, 0, 0, 0, -1, 0, 4, 0, -1, 0, 8, 0, -1, 0, 16, 0, 3, 0, 16, 0, -1, 0, 36, 0, -1, 0, 24, 0, 15, 0, 48, 0, -1, 0, 48, 0, -1, 0, 68, 0, 23, 0, 40, 0, -1, 0, 112, 0, 15, 0, 48, 0, 27, 0, 100, 0, -1, 0, 120, 0, -1, 0, 128, 0, 39, 0, 64, 0, 47, 0, 180, 0, -1, 0, 72, 0, 47, 0, 208, 0, -1, 0, 176, 0, -1, 0, 164, 0, 99
OFFSET
1,8
COMMENTS
The usual OEIS policy is not to include sequences like this where alternate terms are zero; this is an exception.
For all n, a(n) >= -1. Equality holds for n = 2 and n = 2*p for an odd prime p.
FORMULA
a(n) = -A199084(n) - (-1)^n*n = (-1)^n * (A344371(n) - n).
a(2*n+1) = 0.
a(2*n) = A344372(n) - 2*n = -A106475(n-1).
Sum_{k=1..n} a(k) ~ (n^2/4) * ((4/Pi^2)*(log(n) + 2*gamma - 1/2 - 4*log(2)/3 - zeta'(2)/zeta(2)) - 1), where gamma is Euler's constant (A001620). - Amiram Eldar, Mar 30 2024
MATHEMATICA
Array[Sum[(-1)^k GCD[k, #], {k, # - 1}] &, 90] (* Michael De Vlieger, May 16 2021 *)
PROG
(PARI) A344373(n) = sum(k=1, n-1, ((-1)^k)*gcd(k, n)); \\ Antti Karttunen, May 16 2021
CROSSREFS
KEYWORD
sign,easy,look
AUTHOR
Max Alekseyev, May 16 2021
EXTENSIONS
More terms from Antti Karttunen, May 16 2021
STATUS
approved