Let $n!^{(k)}$ denote a multi-factorial which is defined by $$ n!^{(k)} = \begin{cases} 1 & n \leqslant 0, \\ n, & 0 < n < k,\\ n\times(n-k)!^{(k)}, & n \geqslant k. \end{cases} $$

E.g. $8!^{(3)}=8\times5!^{(3)}=8\times5\times2!^{(3)}=8\times5\times2=80$. For $k=3$ we may also put down $8!!!$.

For the case of $k=1$, Mathematica has Factorial[] or ! at hand.

For the case of $k=2$, there is Factorial2[] or !! which calculates double factorials.

For the general case of a $k$th factorial, I could define by recursion

In[1]:= MultiFactorial[n_, k_] := If[n < k, If[n <= 0, 1, n], n MultiFactorial[n - k, k]]

which correctly outputs $8!^{(3)}$ as

In[2]:= MultiFactorial[8, 3]
Out[2]:= 80

But when I have a multi-factorial in every term of an infinite series, Mathematica spits out the original input:

In[3]:= Sum[((-1)^n MultiFactorial[3 n, 3])/MultiFactorial[3 n + 1, 3], {n, 0, +∞}]
Out[3]:= (* More or less the same *)


Definition by Product[]

In[4]:= MultiFactorial[n_, k_] := Product[i, {i, n, 1, -k}]
In[5]:= Sum[((-1)^n MultiFactorial[3 n, 3])/MultiFactorial[3 n + 1, 3], {n, 0, +∞}]

suggests that the sum is divergent.

Yep, I'm trying to verify if

$$\sum\limits_{n=0}^{+\infty} \frac{(-1)^n (3n)!^{(3)}}{(3n+1)!^{(3)}} = -\frac{\sqrt[3]{2}}{4} \ln\left(\sqrt[3]{2}-1\right)+\frac{\sqrt{3}\sqrt[3]{2}}{6}\arctan\frac{\sqrt{3}}{1+2\sqrt[3]{2}}.$$

Question: Are there any built-in functions for the cases of $k\geqslant3$ which is OK to sum?

  • 3
    $\begingroup$ You might be interested in a nonrecursive definition: MultiFactorial[n_, k_] := With[{q = Quotient[n - 1, k]}, k^(q + 1) Gamma[n/k + 1]/Gamma[n/k - q]] $\endgroup$ Nov 21, 2012 at 13:52
  • $\begingroup$ It worked. Output N[Hypergeometric2F1[1, 1, 4/3, -1]] which is $0.590718\cdots$, the same as the given result. Why the difference? Prod doesn't seem to be non-recursive? And I'm now trying to comprehending yours. $\endgroup$
    – Frenzy Li
    Nov 21, 2012 at 14:00

3 Answers 3


(too long for a comment)

Sasha has given an expression in terms of falling factorials. For some reason, however, Sum[(-1)^j MultiFactorial[3 j, 3]/MultiFactorial[3 j + 1, 3], {j, 0, Infinity}] remains unsimplified using the definition of the multifactorial in terms of FactorialPower[].

Either of the following definitions work, though:

MultiFactorial[n_, k_] :=
      With[{q = Quotient[n - 1, k]}, k^(q + 1) Gamma[n/k + 1]/Gamma[n/k - q]]

MultiFactorial[n_, k_] := With[{q = Quotient[n + k - 1, k]}, k^q q! Binomial[n/k, q]]

where Sum[(-1)^j MultiFactorial[3 j, 3]/MultiFactorial[3 j + 1, 3], {j, 0, Infinity}] now evaluates to Hypergeometric2F1[1, 1, 4/3, -1]. Applying FunctionExpand[] to this yields a rather complex expression, but at least it involves only elementary functions.


              Hypergeometric2F1[1, 1, 4/3, -1] ==
              -2^(-5/3) Log[2^(1/3) - 1] + Sqrt[3] 2^(1/3) ArcTan[Sqrt[3]/(1 + 2^(4/3))]/6]]

takes quite long to evaluate, and does not yield anything useful. Thus, we need to exploit a few special function identities like the Pfaff transformation, yielding the identity

$${}_2 F_1\left({{1,1}\atop{\frac43}}\mid-1\right)=\frac12{}_2 F_1\left({{\frac13,1}\atop{\frac43}}\mid\frac12\right)$$

which happens to have a convenient representation in terms of elementary functions.

Using that identity, we have

With[{z = 1/2}, (-Log[1 - z^(1/3)] - (-1)^(2/3) Log[1 + (-1)^(1/3) z^(1/3)] +
     (-1)^(1/3) Log[1 - (-1)^(2/3) z^(1/3)])/(3 z^(1/3))]/2 ==
-2^(-5/3) Log[2^(1/3) - 1] + Sqrt[3] 2^(1/3) ArcTan[Sqrt[3]/(1 + 2^(4/3))]/6 // FullSimplify

which quickly evaluates to True.

My point here, now, is that although Mathematica knows a fair bit about special functions, sometimes one could benefit a lot from helping Mathematica a little bit with a few identities...

  • $\begingroup$ +1. If you follow the strategy outlined in my answer of first simplifying the coefficients, there won't be any problem: a[j_] := Evaluate [ FullSimplify[MultiFactorial[3 j, 3]/MultiFactorial[3 j + 1, 3], Assumptions -> j \[Element] Integers]] re-expresses the sum in terms of Gamma functions and you're all set. $\endgroup$
    – whuber
    Nov 21, 2012 at 19:44
  • $\begingroup$ @whuber, the FullSimplify[] produces the result Gamma[4/3] Gamma[1 + j]/Gamma[4/3 + j] which is more enlighteningly expressed as j!/Pochhammer[4/3, j]. With this expression, the expression in terms of the Gaussian hypergeometric function quickly drops out: $$\sum_{j=0}^\infty \frac{j!}{(4/3)_j}(-1)^j=\sum_{j=0}^\infty \frac{(1)_j}{(4/3)_j}(-1)^j=\sum_{j=0}^\infty \frac{(1)_j (1)_j}{(4/3)_j}\frac{(-1)^j}{j!}={}_2 F_1\left({{1,1}\atop{4/3}}\mid -1\right)$$ $\endgroup$ Nov 21, 2012 at 23:40
  • $\begingroup$ This answers my original intent, and provided a way to verify that the two results are equivalent. $\endgroup$
    – Frenzy Li
    Nov 22, 2012 at 11:19

The multifactorial you are building is built-in in Mathematica under the disguise of FactorialPower:

MultiFactorial2[n_, k_] := FactorialPower[n, Quotient[n - 1, k] + 1, k]

which is the equivalent to J. M.'s expression.

  • $\begingroup$ Using this definition in the sum does not give something that can be symbolically evaluated, unfortunately (the result still has FactorialPower[] expressions within the Sum[]). Thankfully, FactorialPower[] and Binomial[] have a simple relationship, and Binomial[] can be handled by Sum[]. See my answer. $\endgroup$ Nov 21, 2012 at 18:04
  • 1
    $\begingroup$ I like the simplicity of this definition, but the sum still doesn't evaluate. $\endgroup$
    – Frenzy Li
    Nov 22, 2012 at 10:24

Mathematica actually can perform the sum as originally specified. First, supply the recursive definition of "multi-factorial":

factorial[n_, k_] /; n <= 0 := 1;
factorial[n_, k_] /; n <= k := n;
factorial[n_, k_] := factorial[n, k] = n factorial[n - k, k];

The strategy is to simplify the coefficients that will appear in the sum. Unfortunately, a direct attack won't work:

a[n_] := Evaluate[Simplify[factorial[3 n, 3] / factorial[3 n + 1, 3], 
  Assumptions -> n \[Element] Integers && n >= 0]]

This doesn't get us anywhere. Instead, let's try...guessing:

a = FindSequenceFunction[Table[factorial[3 n, 3] / factorial[3 n + 1, 3], {n, 1, 10}]]


We are home free. We can even do a more general sum, using a variable x instead of $-1$:

f[x_] := Evaluate[Sum[x^n a[n], {n, 0, Infinity}] // FullSimplify]

The answer:



(Its connection with ArcTan and Log becomes apparent after looking at FunctionExpand[f[x]].)

One should be sceptical of the result of FindSequenceFunction--it is only guaranteed to agree with the sequence of values given to it, not with all possible indexes--so let's find a way to confirm the correctness of this result. All we have to go on is the recursive definition of factorial. Somehow we need to relate a to this recursion. Looking at a shows it relates factorial[3n,3] to factorial[3n+1,3], whereas the recursive definition of factorial relates factorial[3n,3] to factorial[3n+3,3]. We can get there in three steps, but first need to work out the next two:

b = FindSequenceFunction[Table[factorial[3 n - 1, 3]/factorial[3 n, 3], {n, 1, 10}]]
c = FindSequenceFunction[Table[factorial[3 n - 2, 3]/factorial[3 n - 1, 3], {n, 1, 10}]]

Now 1/(a[n-1]b[n]c[n]) ought to give us the ratio factorial[3n]/factorial[3(n-1)], which, according to the recursion, had better equal $3n$. Indeed,

1/(a[n - 1] b[n] c[n]) // FullSimplify


Because the first four values of factorial are $(1,1,2,3)$, we only need to verify that a[0], c[1], and b[1] return the first three successive ratios $1/1$, $1/2$, $2/3$, which indeed they do. By induction, this proves the result of FindSequenceFunction is correct.

  • 1
    $\begingroup$ Replacing $3$ by $k$ gives the solution $_2F_1\left[1,1,1+\frac{1}{k},x\right]$. Applying FunctionExpand for the case $k=3$ and simplifying yields $-\frac{2 \sqrt{3} \text{ArcTan}\left[1-\frac{x^{1/3}}{2 (1-x)^{1/3}},-\frac{\sqrt{3} x^{1/3}}{2 (1-x)^{1/3}}\right]-2 \text{Log}\left[1+\frac{x^{1/3}}{(1-x)^{1/3}}\right]+\text{Log}\left[1+\frac{x^{2/3}-(-(-1+x) x)^{1/3}}{(1-x)^{2/3}}\right]}{6 (1-x)^{2/3} x^{1/3}}$, showing the connection with ArcTan and Log. $\endgroup$
    – whuber
    Nov 21, 2012 at 17:32
  • 1
    $\begingroup$ You have fact[] in the definition of a[]... typo? Also, replacing fact[] with your definition of factorial[] in a[]'s definition yields the expected $RecursionLimit error... $\endgroup$ Nov 21, 2012 at 17:59
  • 1
    $\begingroup$ @J.M. Thank you for looking at this! I made a really stupid mistake by using the wrong definition for a. This requires a different approach, which I have incorporated in an edited version. The new approach is a little weaker because it's not fully automatic and elementary, but it may still be of interest in showing how to discover useful formulas for recursively defined functions and how to prove them correct once they have been found. $\endgroup$
    – whuber
    Nov 21, 2012 at 19:36
  • 1
    $\begingroup$ (+1) I like to explore, and I like your answer. I hope you won't mind that I "accept" @J.M. 's answer, as his directly answers my question. $\endgroup$
    – Frenzy Li
    Nov 22, 2012 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.