OFFSET
1,2
FORMULA
a(n) = n^2 - A063985(n). - Enrique Pérez Herrero, Feb 25 2012
MAPLE
A091369:=n->add(numtheory[phi](i)*ceil(n/i), i=1..n): seq(A091369(n), n=1..100); # Wesley Ivan Hurt, Apr 13 2017
MATHEMATICA
A091369[n_] := Sum[EulerPhi[i]*Ceiling[n/i], {i, n}] (* Robert G. Wilson v, Mar 02 2004 *)
PROG
(PARI) a(n) = sum(k=1, n, eulerphi(k)*ceil(n/k)); \\ Michel Marcus, Apr 13 2017
(Python)
from functools import lru_cache
@lru_cache(maxsize=None)
def A091369(n):
if n == 0:
return 0
c, j = 0, 2
k1 = n//j
while k1 > 1:
j2 = n//k1 + 1
c += (j2-j)*(2*A091369(k1)-(k1*(k1-1)+1))
j, k1 = j2, n//j2
return n*(n-1)-(c-j)//2 # Chai Wah Wu, Mar 29 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jon Perry, Mar 01 2004
EXTENSIONS
More terms from Robert G. Wilson v, Mar 02 2004
STATUS
approved