PINKLETES
FACTORIALS
A factorial is a mathematical operation denoted by an exclamation mark (!). It is used to calculate the product of all positive integers from 1 up to a given number.
Example: 5! = 5 × 4 × 3 × 2 × 1 = 120
Questions: What is 8!/5! ?
Solution: Although you may solve the problem by computing 8!/5! directly, you can also simplify the problem by crossing out 5! from the numerator and denominator.
(8 x 7 x 6 x 5 x 4 x 3 x 2)/(5 x 4 x 3 x 2) -> (8 x 7 x 6) = 336
​
​
DOUBLE FACTORIALS
A double factorial, denoted as n!!, is a variation of the factorial operation. Instead of multiplying all positive integers from 1 up to a given number (n), a double factorial multiplies every other integer starting from 1 up to n. In other words, it's the product of all the odd integers or all the even integers up to n, depending on whether n is odd or even.
The calculation of a double factorial can be represented as follows:
-
If n is even: n!! = n × (n-2) × (n-4) × ... × 4 × 2.
-
If n is odd: n!! = n × (n-2) × (n-4) × ... × 3 × 1.
Example:
6!! = 6 × 4 × 2 = 48.
7!! = 7 × 5 × 3 × 1 = 105.
​