OFFSET
1,3
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = A058006(n) mod n. - R. J. Mathar, Jul 13 2012
EXAMPLE
a(1) = 0! mod 1 = 1 mod 1 = 0;
a(2) = (0!-1!) mod 2 = (1 - 1) mod 2 = 0;
a(3) = (0!-1!+2!) mod 3 = (1 - 1 + 2) mod 3 = 2.
MAPLE
A176787 := proc(n): add((-1)^(k-1)*(k-1)!, k=1..n) mod n end: seq(A176787(n), n=1..81); # Johannes W. Meijer, Jun 28 2011
MATHEMATICA
Table[Mod[Sum[(-1)^k*k!, {k, 0, n - 1}], n], {n, 81}] (* Michael De Vlieger, Apr 22 2015 *)
PROG
(PARI) a(n) = sum(k=0, n-1, (-1)^k*k!) % n; \\ Michel Marcus, Apr 22 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Paolo P. Lava & Giorgio Balzarotti, Apr 26 2010
EXTENSIONS
Edited by Johannes W. Meijer, Jun 28 2011
STATUS
approved