login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A325887 Excess of sum of odd integers up to n and coprime to n over sum of even integers up to n and coprime to n. 0
1, 1, -1, 4, -2, 6, -3, 16, -1, 20, -5, 24, -6, 42, 4, 64, -8, 54, -9, 80, 6, 110, -11, 96, -2, 156, -1, 168, -14, 120, -15, 256, 10, 272, 12, 216, -18, 342, 12, 320, -20, 252, -21, 440, 4, 506, -23, 384, -3, 500, 16, 624, -26, 486, 20, 672, 18, 812, -29, 480, -30, 930, 6, 1024, 24 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,4

LINKS

Table of n, a(n) for n=1..65.

FORMULA

a(n) = Sum_{k=1..n, gcd(k,n)=1} (-1)^(k+1)*k.

If n even, a(n) = n*phi(n)/2.

a(p^k) = floor(p/2) - p + 1, where p is odd prime.

MATHEMATICA

a[n_] := Sum[Boole[GCD[k, n] == 1] (-1)^(k + 1) k, {k, 1, n}]; Table[a[n], {n, 1, 65}]

PROG

(PARI) a(n)={sum(k=1, n, -if(gcd(k, n)==1, (-1)^k*k))} \\ Andrew Howroyd, Sep 07 2019

CROSSREFS

Cf. A000010, A002129, A023896, A038566, A098903 (positions of negative terms).

Sequence in context: A308712 A275845 A281978 * A209877 A273667 A187109

Adjacent sequences:  A325884 A325885 A325886 * A325888 A325889 A325890

KEYWORD

sign

AUTHOR

Ilya Gutkovskiy, Sep 07 2019

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 4 14:11 EDT 2020. Contains 336201 sequences. (Running on oeis4.)