OFFSET
0,3
COMMENTS
The triple factorial of a positive integer n is the product of the positive integers <= n that have the same residue modulo 3 as n. - Peter Luschny, Jun 23 2011
REFERENCES
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
J. Spanier and K. B. Oldham, An Atlas of Functions, Hemisphere, NY, 1987, p. 23.
LINKS
T. D. Noe, Table of n, a(n) for n = 0..200
Eric Weisstein's World of Mathematics, Multifactorial.
FORMULA
a(n) = Product_{i=0..floor((n-1)/3)} (n-3*i). - M. F. Hasler, Feb 16 2008
a(n) ~ c * n^(n/3+1/2)/exp(n/3), where c = sqrt(2*Pi/3) if n=3*k, c = sqrt(2*Pi)*3^(1/6) / Gamma(1/3) if n=3*k+1, c = sqrt(2*Pi)*3^(-1/6) / Gamma(2/3) if n=3*k+2. - Vaclav Kotesovec, Jul 29 2013
a(3*n) = A032031(n); a(3*n+1) = A007559(n+1); a(3*n+2) = A008544(n+1). - Reinhard Zumkeller, Sep 20 2013
0 = a(n)*(a(n+1) -a(n+4)) +a(n+1)*a(n+3) for all n>=0. - Michael Somos, Feb 24 2019
Sum_{n>=0} 1/a(n) = A288055. - Amiram Eldar, Nov 10 2020
MAPLE
A007661 := n -> mul(k, k = select(k -> k mod 3 = n mod 3, [$1 .. n])): seq(A007661(n), n = 0 .. 29); # Peter Luschny, Jun 23 2011
MATHEMATICA
multiFactorial[n_, k_] := If[n < 1, 1, If[n < k + 1, n, n*multiFactorial[n - k, k]]]; Array[ multiFactorial[#, 3] &, 30, 0] (* Robert G. Wilson v, Apr 23 2011 *)
RecurrenceTable[{a[0]==a[1]==1, a[2]==2, a[n]==n*a[n-3]}, a, {n, 30}] (* Harvey P. Dale, May 17 2012 *)
Table[With[{q = Quotient[n + 2, 3]}, 3^q q! Binomial[n/3, q]], {n, 0, 30}] (* Jan Mangaldan, Mar 21 2013 *)
a[ n_] := With[{m = Mod[n, 3, 1], q = 1 + Quotient[n, 3, 1]}, If[n < 0, 0, 3^q Pochhammer[m/3, q]]]; (* Michael Somos, Feb 24 2019 *)
Table[Times@@Range[n, 1, -3], {n, 0, 30}] (* Harvey P. Dale, Sep 12 2020 *)
PROG
(PARI) A007661(n, d=3)=prod(i=0, (n-1)\d, n-d*i) \\ M. F. Hasler, Feb 16 2008
(Haskell)
a007661 n k = a007661_list !! n
a007661_list = 1 : 1 : 2 : zipWith (*) a007661_list [3..]
-- Reinhard Zumkeller, Sep 20 2013
(Magma) I:=[1, 1, 2]; [n le 3 select I[n] else (n-1)*Self(n-3): n in [1..30]]; // Vincenzo Librandi, Nov 27 2015
(Sage)
def a(n):
if (n<3): return fibonacci(n+1)
else: return n*a(n-3)
[a(n) for n in (0..30)] # G. C. Greubel, Aug 21 2019
(GAP)
a:= function(n)
if n<3 then return Fibonacci(n+1);
else return n*a(n-3);
fi;
end;
List([0..30], n-> a(n) ); # G. C. Greubel, Aug 21 2019
CROSSREFS
KEYWORD
nonn,easy,nice
STATUS
approved