OFFSET
1,4
FORMULA
G.f.: -x^2*(2 - x)/(1 - x)^2 - Sum_{k>=2} mu(k)*k*x^k/(1 - x^k)^3.
a(n) = Sum_{k=1..n-1, gcd(n,k) > 1} k.
a(n) = n*(n - phi(n) - 1)/2 for n > 1
a(n) = n*A016035(n)/2.
a(n) = A067392(n) - n for n > 1.
a(n) = 0 if n is in A008578.
Sum_{k=1..n} a(k) ~ (1/6 - 1/Pi^2)*n^3. - Vaclav Kotesovec, May 30 2019
MATHEMATICA
nmax = 65; CoefficientList[Series[-x^2 (2 - x)/(1 - x)^2 - Sum[MoebiusMu[k] k x^k/(1 - x^k)^3, {k, 2, nmax}], {x, 0, nmax}], x] // Rest
a[n_] := Sum[If[GCD[n, k] > 1, k, 0], {k, 1, n - 1}]; Table[a[n], {n, 1, 65}]
Join[{0}, Table[n (n - EulerPhi[n] - 1)/2, {n, 2, 65}]]
PROG
(PARI) a(n) = sum(k=1, n-1, if (gcd(n, k)>1, k)); \\ Michel Marcus, May 31 2019
(Python)
from sympy import totient
def A308473(n): return n*(n-totient(n)-1)>>1 if n>1 else 0 # Chai Wah Wu, Nov 06 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Ilya Gutkovskiy, May 29 2019
STATUS
approved