OFFSET
1,2
COMMENTS
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
Eric Weisstein's World of Mathematics, Double Factorial
EXAMPLE
5!! = 5*3*1 = 15, a(5) = 15 mod (5+1) = 3.
6!! = 6*4*2 = 48, a(6) = 48 mod (6+1) = 6.
MAPLE
P:= proc(n) local i, j, k, s; for k from 1 by 1 to n do i:=k; j:=k-2; while j >0 do i:=i*j; j:=j-2; od: s:=i mod (k+1); print(s); od: end: P(100);
## another version:
a:= proc(n) local t, m;
if irem (n, 2)=1 or n<14 or isprime(n+1)
then t:= 1;
for m from n by -2 while m>1 do
t:= (t*m) mod (n+1)
od; t
else 0 fi
end:
seq(a(n), n=1..100); # Alois P. Heinz, Feb 15 2011
MATHEMATICA
Table[Mod[n!!, n+1], {n, 100}] (* Zak Seidov, Feb 15 2011 *)
PROG
(Magma) DoubleFactorial:=func< n | &*[n..2 by -2] >; [ DoubleFactorial(n) mod (n+1): n in [1..100] ]; // Klaus Brockhaus, Feb 15 2011
(PARI) a(n) = prod(i=0, (n-1)\2, n - 2*i) % (n+1); \\ after PARI for A006882; Michel Marcus, Aug 22 2016
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Paolo P. Lava and Giorgio Balzarotti, Jun 09 2006
EXTENSIONS
a(63) corrected, a(64) inserted by Klaus Brockhaus, Feb 15 2011
STATUS
approved