login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A024925
Sum of remainders of n mod prime(k), for k = 1,2,3,...,n.
0
1, 2, 4, 9, 13, 19, 25, 38, 52, 64, 74, 92, 104, 122, 143, 172, 188, 218, 236, 268, 299, 329, 351, 393, 437, 473, 523, 569, 597, 646, 676, 737, 788, 836, 893, 959, 995, 1049, 1110, 1182, 1222, 1293, 1335, 1409, 1490, 1556, 1602, 1692, 1782, 1874, 1955, 2043, 2095, 2197, 2290
OFFSET
1,2
FORMULA
G.f.: x * (1 + x)/(1 - x)^3 - (1/(1 - x)) * Sum_{k>=1} prime(k) * x^prime(k)/(1 - x^prime(k)). - Ilya Gutkovskiy, Jul 16 2019
PROG
(Magma) [&+[n mod NthPrime(k): k in [1..n]]:n in [1..55]]; // Marius A. Burtea, Jul 16 2019
(PARI) a(n) = sum(k=1, n, n % prime(k)); \\ Michel Marcus, Jul 18 2019
(PARI) a(n) = my(s=0); forprime(p=2, prime(n), s += n%p); s; \\ Michel Marcus, Jul 18 2019
CROSSREFS
Sequence in context: A343216 A320514 A210640 * A162342 A162761 A357355
KEYWORD
nonn
STATUS
approved