OFFSET
1,3
COMMENTS
Alternating sum of double factorials modulo n.
FORMULA
a(n) = (Sum_{k=0..n-1} (-1)^k*k!!) mod n = (1 + (-1)^(n-1)*A129831(n-1)) mod n.
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
MATHEMATICA
Table[Mod[Sum[(-1)^k k!!, {k, 0, n-1}], n], {n, 90}] (* Harvey P. Dale, Dec 08 2012 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Paolo P. Lava & Giorgio Balzarotti, Apr 26 2010
STATUS
approved