Factorial Formula
n! = n*(n-1)*(n-2)*...*3*2*1
List of first 12 Factorials: [Christmas is coming ;-) ]
0!=1
1!=1
2!=2*1=2
3!=3*2*1=6
4!=4*3*2*1=24
5!=5*4*3*2*1=120
6!=6*5*4*3*2*1=720
7!=7*6*5*4*3*2*1=5,040
8!=8*7*6*5*4*3*2*1=40,320
9!=9*8*7*6*5*4*3*2*1=362,880
10!=10*9*8*7*6*5*4*3*2*1=3,628,800
11!=11*10*9*8*7*6*5*4*3*2*1=39,916,800
Real Life Usage: n! gives the number of rearrangements of n objects.
Example 1: 2 letters AB can be rearranged in 2!=2 ways:
AB and BA
Example 2: 3 letters ABC can be rearranged in 3!=6 ways:
ABC,ACB,BAC,BCA,CAB,CBA
Example 3: 4 letters ABCD can be rearranged in 4!=24 ways:
Looking at ABC, the letter D can be placed before A, before B, before C or after C, that's 4 ways.
Multiply that by the 6 different arrangements yields 6*4 or 3!*4 = 24.
DABC,ADBC,ABDC,ABCD, DACB,ADCB, ..... , CBAD
Example 4: 4 letters ABCA can be rearranged in 4!/2!=12 ways:
AABC,ABAC,ABCA,BAAC,BACA,BCAA,CAAB,CABA,CBAA,DAAB,DABA,DBAA
Recursive Property: n! = n*(n-1)! or solved for n: n = n!/(n-1)!
Example 1: 3!=3*2! = 3*2
Example 2: 4!=4*3! = 4*6
Example 3: 5!=5*4! = 5*24
To compute n! just multiply the previously computed (n-1)! by n.
This may save a lot of time and mental energy.
Example 4: 10!/9! = 10*9*8*7*6*5*4*3*2*1 / 9*8*7*6*5*4*3*2*1 = 10 since all integers on top and bottom
cancel out except for the 10 on top. No need to compute 10! or 9!.
Example 5: For the same reason 678!/677! = 678 .
Example 6: How about 102!/100! ? I will let you figure this one out...