It's Calculus. Very basic calculus.
The n! portion means take the arbitrary integer n (from 0 to infinity) and the multiply it by each of the next lower numbers.
function factorial($number)
{
if ($number == 0)
return $number;
else
return $number * factorial($number - 1);
}
That's how it works. (Arbitrary pseudo-code, I didn't actually test it, but it should work fine.)
0! = 1;
1! = 1 * 0! = 1;
2! = 2 * 1! = 2 * 1 * 0! = 2;
3! = 3 * 2! = 3 * 2 * 1! = 3 * 2 * 1 * 0! = 6;
4! = 4 * 3! = 4 * 3 * 2! = 4 * 3 * 2 * 1! = 4 * 3 * 2 * 1 * 0! = 24;
Thanks,
EBrown