cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A166248 #12 Nov 02 2023 14:20:11
%S A166248 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 A166248 98,96,122,108,136,135,151,163,183,162,196,210,230,218,256,242,282,
%U A166248 284,294,312,356,326,365,370,398,402,452,438,474,464,496,520,576,526,584,610
%N A166248 a(n) is the absolute value of n minus sum of all the remainders modulo the numbers below n.
%F A166248 a(n) = abs(n - Sum_{k=1..n} (n mod k)).
%F A166248 a(n) = abs(n - A004125(n)). - _Michel Marcus_, May 08 2019
%e A166248 a(1) = abs(1-0) = 1;
%e A166248 a(2) = abs(2-0) = 2;
%e A166248 a(3) = abs(3-1) = 2;
%e A166248 a(4) = abs(4-1) = 3;
%e A166248 a(5) = abs(5-4) = 1;
%e A166248 a(6) = abs(6-3) = 3;
%e A166248 a(7) = abs(7-8) = 1.
%p A166248 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 A166248 (Python)
%o A166248 from math import isqrt
%o A166248 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 A166248 Cf. A000027, A004125, A163180.
%K A166248 nonn
%O A166248 1,2
%A A166248 _Juri-Stepan Gerasimov_, Oct 10 2009
%E A166248 a(19), a(20), a(37) etc. corrected by _R. J. Mathar_, Oct 24 2009