login
A176789
a(n) = (0!! - 1!! + 2!! - 3!! + ... + (-1)^(n-1)*(n-1)!!) mod n.
2
0, 0, 2, 3, 2, 4, 5, 7, 4, 4, 2, 7, 3, 0, 4, 3, 5, 10, 3, 19, 7, 4, 3, 7, 14, 0, 10, 7, 5, 4, 29, 11, 4, 6, 14, 19, 4, 26, 13, 39, 13, 28, 2, 15, 19, 20, 11, 19, 14, 14, 40, 39, 0, 10, 4, 7, 7, 8, 7, 19, 26, 38, 28, 27, 39, 4, 57, 23, 43, 14, 5, 55, 30, 6, 64, 7, 70, 52, 50, 19, 37, 10, 75, 7
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
A176789 := proc(n)
modp(1-(-1)^n*A129831(n-1), n) ;
end proc: # R. J. Mathar, Aug 22 2012
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
STATUS
approved