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!)
A099726 Sum of remainders of the n-th prime mod k, for k = 1,2,3,...,n. 3
0, 1, 3, 5, 7, 7, 14, 18, 28, 30, 31, 26, 38, 45, 63, 71, 93, 75, 96, 115, 101, 142, 161, 167, 152, 159, 203, 224, 219, 222, 216, 250, 263, 296, 341, 320, 319, 349, 433, 427, 496, 419, 487, 481, 538, 537, 495, 631, 635, 676, 697, 777, 665, 820, 784, 874, 929, 856 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
LINKS
FORMULA
a(n) = n*p - A024916(p) + Sum_{k=n+1..p} k*floor(p/k), where p = prime(n). - Daniel Suteu, Feb 02 2021
EXAMPLE
a(7)=14 because the 7th prime is 17 and its remainders modulo 1,2,3,4,5,6,7 are 0,1,2,1,2,5,3 respectively and 0+1+2+1+2+5+3=14.
MAPLE
umpf:=n->add(modp(floor(ithprime(n)), m), m=1..n); seq(umpf(k), k=1..120);
PROG
(PARI) a(n) = my(p=prime(n)); sum(k=1, n, p%k); \\ Daniel Suteu, Feb 02 2021
(PARI)
T(n) = n*(n+1)/2;
S(n) = my(s=sqrtint(n)); sum(k=1, s, T(n\k) + k*(n\k)) - s*T(s); \\ A024916
g(a, b) = my(s=0); while(a <= b, my(t=b\a); my(u=b\t); s += t*(T(u) - T(a-1)); a = u+1); s;
a(n) = my(p=prime(n)); n*p - S(p) + g(n+1, p); \\ Daniel Suteu, Feb 02 2021
CROSSREFS
Sequence in context: A242999 A098566 A006540 * A327096 A202664 A202124
KEYWORD
easy,nonn
AUTHOR
Joseph Biberstine (jrbibers(AT)indiana.edu), Nov 07 2004
EXTENSIONS
Definition corrected by Daniel Suteu, Feb 02 2021
STATUS
approved

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 25 11:39 EDT 2024. Contains 371969 sequences. (Running on oeis4.)