How this calculation works
Order matters: selecting A then B is different from B then A. Objects are distinct and cannot be selected more than once. Selecting zero objects gives one empty arrangement.
P(n, r) = n! ÷ (n − r)!A worked example
Choosing and ordering 3 objects from 10 gives 720 permutations.
Good to know
Counts become approximate beyond the exact-integer range of JavaScript numbers. Repeated objects and selection with replacement use different formulas.
Assigning roles makes order matter
For first, second and third place among ten distinct contestants, there are ten choices for first, nine remaining for second and eight for third. Multiplication gives 720 ordered outcomes.
Switching the same three names between positions creates a different outcome. If only membership matters and the positions are interchangeable, divide out those internal orders using the combinations model instead.
Do not reuse an object unless the model permits it
The formula here is without replacement. A password where each position may reuse a character instead has the same number of choices at each position, producing a different counting rule.
A zero-length selection has one empty ordering. If all n objects are selected, the result is n!. Large results are numerical approximations and may overflow the browser’s finite number range.
A few questions, answered
What is the difference from n factorial?
n! orders all n objects. P(n, r) orders only a selection of r objects.
Does this handle repeated identical letters?
No. Indistinguishable repeated objects require adjusting for their repeated arrangements.