OFFSET
1,2
FORMULA
a(n) = abs(n - Sum_{k=1..n} (n mod k)).
a(n) = abs(n - A004125(n)). - Michel Marcus, May 08 2019
EXAMPLE
a(1) = abs(1-0) = 1;
a(2) = abs(2-0) = 2;
a(3) = abs(3-1) = 2;
a(4) = abs(4-1) = 3;
a(5) = abs(5-4) = 1;
a(6) = abs(6-3) = 3;
a(7) = abs(7-8) = 1.
MAPLE
A004125 := proc(n) add( modp(n, k), k=1..n) ; end proc: A166248 := proc(n) abs(n-A004125(n)) ; end: seq(A166248(n), n=1..100) ; # R. J. Mathar, Oct 24 2009
PROG
(Python)
from math import isqrt
def A166248(n): return abs(n*(n-1)+((s:=isqrt(n))**2*(s+1)-sum((q:=n//k)*((k<<1)+q+1) for k in range(1, s+1))>>1)) # Chai Wah Wu, Nov 01 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Juri-Stepan Gerasimov, Oct 10 2009
EXTENSIONS
a(19), a(20), a(37) etc. corrected by R. J. Mathar, Oct 24 2009
STATUS
approved