OFFSET
0,6
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..10000
FORMULA
EXAMPLE
a(5) = 3. The remainder when 5 is divided by primes 2, 3 respectively is 1, 2, and their sum = 3.
10 = 2*5+0 = 3*3+1 = 5*2+0 = 7*1+3: a(10) = 0+1+0+3 = 4.
MATHEMATICA
a[n_] := Sum[Mod[n, Prime[i]], {i, PrimePi@ n}]; Array[a, 72, 0] (* Giovanni Resta, Jun 24 2016 *)
PROG
(PARI) a(n)=my(r=0); forprime(p=2, n, r+=n%p); r; \\ Joerg Arndt, Nov 05 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
Edited by Max Alekseyev, Jan 30 2012
a(0)=0 prepended by Max Alekseyev, Dec 10 2013
STATUS
approved