login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A199084 a(n) = Sum_{k=1..n} (-1)^(k+1) gcd(k,n). 8
1, -1, 3, -4, 5, -5, 7, -12, 9, -9, 11, -20, 13, -13, 15, -32, 17, -21, 19, -36, 21, -21, 23, -60, 25, -25, 27, -52, 29, -45, 31, -80, 33, -33, 35, -84, 37, -37, 39, -108, 41, -65, 43, -84, 45, -45, 47, -160, 49, -65, 51, -100, 53, -81, 55, -156, 57 (list; graph; refs; listen; history; text; internal format)
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(n) = (-1)^(n+1)*A344371(n) = A344373(n) - (-1)^n*n. - Max Alekseyev, May 16 2021
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
MAPLE
A199084 := proc(n)
add((-1)^(k-1)* igcd(k, n), k=1..n) ;
end proc:
seq(A199084(n), n=1..80) ;
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
Sequence in context: A261017 A024357 A300778 * A344371 A322004 A240214
KEYWORD
sign,easy
AUTHOR
R. J. Mathar, Nov 02 2011
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 4 10:30 EDT 2024. Contains 372240 sequences. (Running on oeis4.)