Factorial:
The factorial of a number is specified by an exclamation mark. It is the number of different ways you can order n elements.
It is the product of the first n positive natural numbers, so it is an integer.
Using the product symbol as seen in another section we can also write it as:
From this we also get . It is not defined for negative values.
Attention: The factorial increases very rapidly. If you use a 32 bit signed integer, then will already overflow. Even for a 64 bit signed integer, is too much. So if you see a formula involving factorials, try to cancel out terms as much as possible. For example, if :
Code: