OFFSET
1,2
COMMENTS
Sum of k <= n such that gcd(n,k) > 1.
V. S. Guba conjectured that for any positive n and prime p, a(n) != a(n+p). - Max Alekseyev, May 08 2024
LINKS
Ivan Neretin, Table of n, a(n) for n = 1..10000
FORMULA
Not multiplicative.
a(p) = p where p is a prime; a(2^k) = 2^(k-1)*(2^(k-1) + 1).
G.f.: -Sum_{k>=2} mu(k)*k*x^k/(1 - x^k)^3. - Ilya Gutkovskiy, May 28 2019
Sum_{k=1..n} a(k) ~ (1/6 - 1/(Pi^2)) * n^3. - Amiram Eldar, Dec 03 2023
EXAMPLE
For n=24, a(24) = 2+3+4+6+8+9+10+12+14+15+16+18+20+21+22+24 = 204.
MATHEMATICA
a[n_] := Plus@@Select[Range[1, n], GCD[ #, n]>1&]
Join[{0}, Table[n (n + 1) / 2 - n EulerPhi@(n) / 2, {n, 2, 60}]] (* Vincenzo Librandi, Jul 19 2019 *)
PROG
(PARI) A067392(n)={a=0; for(i=1, n, if(gcd(i, n)<>1, a=a+i)); a}
(PARI) a(n) = sum(k=1, n, k*(gcd(k, n) != 1)); \\ Michel Marcus, May 08 2018
(PARI) a(n) = if(n == 1, 0, n*(n + 1 - eulerphi(n))/2); \\ Amiram Eldar, Dec 03 2023
(Magma) [0] cat [n*(n+1)/2-n*EulerPhi(n)/2: n in [2..60]]; // Vincenzo Librandi, Jul 19 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Labos Elemer, Jan 22 2002
STATUS
approved