OFFSET
1,3
COMMENTS
The alternating sum analog of A018804.
a(2n) <= -(2n-1) (cf. A344372). - Max Alekseyev, May 16 2021
LINKS
Vincenzo Librandi and Seiichi Manyama, Table of n, a(n) for n = 1..10000 (first 1000 terms from Vincenzo Librandi)
Laszlo Toth, Weighted Gcd-Sum Functions, J. Int. Seq. 14 (2011) # 11.7.7.
FORMULA
a(2n+1) = 2n+1. - Seiichi Manyama, Dec 09 2016
a(2n) = -A344372(n). - Max Alekseyev, May 16 2021
Sum_{k=1..n} a(k) ~ (n^2/Pi^2) * (-log(n) - 2*gamma + 1/2 + 4*log(2)/3 + Pi^2/4 + zeta'(2)/zeta(2)), where gamma is Euler's constant (A001620). - Amiram Eldar, Mar 30 2024
MATHEMATICA
altGCDSum[n_] := Sum[(-1)^(i + 1)GCD[i, n], {i, n}]; Table[altGCDSum[n], {n, 50}] (* Alonso del Arte, Nov 02 2011 *)
Total/@Table[(-1)^(k+1) GCD[k, n], {n, 60}, {k, n}] (* Harvey P. Dale, May 29 2013 *)
PROG
(PARI) a(n) = sum(k=1, n, (-1)^(k+1)*gcd(k, n)); \\ Michel Marcus, Jun 28 2023
CROSSREFS
KEYWORD
sign,easy
AUTHOR
R. J. Mathar, Nov 02 2011
STATUS
approved