Does double subfactorial exist

factorialsoft-question

Mainly, I have 2 questions regarding factorial. However since I'm only allowed to post one question per one post, I'll post my second question later. The reason I'm asking these questions is because someone posted this problem on Facebook and I'm interested in knowing how to solve this:

enter image description here

First question is 'does double subfactorial exist?' For instance, I'm wondering how to calculate

$$!!5$$

I found the general formula from Wolfram Mathworld for single-subfactorial i.e.

$$!n \equiv n!\sum_{k=0}^n \frac{(-1)^k}{k!}$$

How about double subfactorial? Is it

$$!!n \equiv n!!\sum_{k=0}^n \frac{(-1)^k}{k!!}\quad?$$

The link I provide above also gives the alternative i.e. generalizing the subfactorial into complex number. I read somewhere that this function ($f(z) = !z$) is analytic and defined in the whole complex z-plane (unlike the gamma function that the domain has no negative integers). Anyway, this is another representation of $!n$:

$$\int_{-1}^{\infty} x^n e^{-(x+1)}\, \Bbb d x$$

In conclusion, how do I compute the double subfactorial of any number by a formula?

Best Answer

You will find a table of double subfactorials in sequence $A334578$ in $OEIS$ (have look here).

As you will read it in the title, they "simply" are $$!!n= (-1)^{\left\lfloor \frac{n}{2}\right\rfloor }\,n\text{!!}\sum_{i=0}^{\left\lfloor \frac{n}{2}\right\rfloor}\frac{(-1)^i}{(n-2 i)\text{!!}}$$

Still according to the documentation, they obey the reccurence equation $$a_{n}=n\,a_{n-2}+(-1)^{\left\lfloor \frac{n}{2}\right\rfloor }\qquad \text{with} \qquad a_0=a_1=1$$

You will find a table fof the first $807$ terms (this is probably because this term is the last before $10^{1000}$).