login
A176787
a(n) = (0!-1!+2!-3!....(-1)^(n-1)*(n-1)!) mod n.
3
0, 0, 2, 0, 0, 2, 4, 4, 8, 0, 5, 8, 0, 4, 5, 12, 9, 8, 15, 0, 11, 16, 19, 20, 20, 0, 17, 4, 20, 20, 10, 28, 5, 26, 25, 8, 0, 34, 26, 20, 2, 32, 6, 16, 35, 42, 7, 44, 11, 20, 26, 0, 21, 44, 5, 4, 53, 20, 33, 20, 49, 10, 53, 60, 0, 38, 6, 60, 65, 60, 65, 44, 16, 0, 20, 72, 60, 26, 5, 60, 17
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
Cf. A049782, A064383 (n such that a(n) is 0).
Sequence in context: A028641 A325190 A141416 * A127862 A342223 A223142
KEYWORD
nonn
AUTHOR
EXTENSIONS
Edited by Johannes W. Meijer, Jun 28 2011
STATUS
approved