OFFSET
1,3
LINKS
Daniel Suteu, Table of n, a(n) for n = 1..10000
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
KEYWORD
easy,nonn
AUTHOR
Joseph Biberstine (jrbibers(AT)indiana.edu), Nov 07 2004
EXTENSIONS
Definition corrected by Daniel Suteu, Feb 02 2021
STATUS
approved