Print
(Reading time: 1 minute)
The double factorial is a mathematical operation defined recursively as:
\[n!!=\left\{\begin{matrix}1\ if\ n\leq 0\\n(n-2)!!\ otherwise \end{matrix} \right. \]
eg.
\[ \textit{8!!=8*6*4*2*1=  384  } \]
An algorithm can be implemented very simply in a recursive way, where the method calls itself many times. That is an implementation:

public static long doubleFact(long n){
if(n>=52)return 0;
if(n<=0)
return 1;
else
return doubleFact(n-2)*n;

}
Joomla SEF URLs by Artio