Each formula involves factorial. 6! = 1 * 2 * 3* 4 * 5* 6

Here is how you calculate (12)P(3).

(12)P(3) means N = 12 and R = 3.

(12)P(3) = (12!)/(12-3)! = 1320

(12)C(3) = (12!)/[(12-3)!* 3!] = 220

To calculate Repitition. Consider the following example.

How many permutations are there of the letters

MASSACHUSETTS?

Of the 13 letters of there are 4 S's, 2 A's, 2 T's, 1 M, 1 C, 1 H, 1 U, and 1 E.

So the number of permutations with repetition are :

(13!) / (4! * 2! * 2! * 1! * 1! * 1! * 1! * 1!)

Write a Java script program which will input two integers 0 <= R <= N,

and then output the Combination and Permutation (including repition) of those numbers.

Permutations | Permutations with Repitition | Combinations |
---|---|---|

(N)P(R) = (N!) / [ (N - R)! ] | (N)P(R) = (N!) / (N1! * N2! * N3! ...NR!) | (N)C(R) = (N!) / [ (N - R)! * R!] |