OFFSET
1,2
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..2000
EXAMPLE
Let n=4, p_4=7. We have modulo 7: 1!==1, 2!==2, 3!==6, 4!==3, 5!==1, 6!==6 and for m>=7, m!==0, such that we have 5 distinct residues 0,1,2,3,6. Therefore a(4)=0+1+2+3+6=12.
MATHEMATICA
Table[Total[Union[Mod[Range[Prime[n]]!, Prime[n]]]], {n, 100}] (* T. D. Noe, Mar 18 2012 *)
PROG
(PARI) a(n) = my(p=prime(n)); vecsum(Set(vector(p, k, k! % p))); \\ Michel Marcus, Dec 15 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Mar 18 2012
STATUS
approved