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
KEYWORD
nonn
AUTHOR
STATUS
approved