login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A166248 a(n) is the absolute value of n minus sum of all the remainders modulo the numbers below n. 1

%I #12 Nov 02 2023 14:20:11

%S 1,2,2,3,1,3,1,0,3,3,11,5,15,17,21,20,34,29,45,41,49,55,75,61,78,86,

%T 98,96,122,108,136,135,151,163,183,162,196,210,230,218,256,242,282,

%U 284,294,312,356,326,365,370,398,402,452,438,474,464,496,520,576,526,584,610

%N a(n) is the absolute value of n minus sum of all the remainders modulo the numbers below n.

%F a(n) = abs(n - Sum_{k=1..n} (n mod k)).

%F a(n) = abs(n - A004125(n)). - _Michel Marcus_, May 08 2019

%e a(1) = abs(1-0) = 1;

%e a(2) = abs(2-0) = 2;

%e a(3) = abs(3-1) = 2;

%e a(4) = abs(4-1) = 3;

%e a(5) = abs(5-4) = 1;

%e a(6) = abs(6-3) = 3;

%e a(7) = abs(7-8) = 1.

%p 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

%o (Python)

%o from math import isqrt

%o 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

%Y Cf. A000027, A004125, A163180.

%K nonn

%O 1,2

%A _Juri-Stepan Gerasimov_, Oct 10 2009

%E a(19), a(20), a(37) etc. corrected by _R. J. Mathar_, Oct 24 2009

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 19:02 EDT 2024. Contains 371798 sequences. (Running on oeis4.)