Permutations (order matters)
In counting problems, a permutation is an arrangement where the order of choices matters.
If you have \(n\) distinct items and you want to form an ordered sequence of length \(r\), the question is:
how many different sequences can you make?
This is written as \(P(n,r)\) or \(nP_r\).
Without repetition: \(P(n,r)\)
If you cannot reuse items (no repetition), then there are \(n\) choices for the first position,
\(n-1\) for the second, and so on until you fill \(r\) positions.
Multiplying the number of choices at each step gives the product form:
\[
P(n,r)=n(n-1)(n-2)\cdots(n-r+1).
\]
This same quantity can also be expressed using factorials:
\[
P(n,r)=\frac{n!}{(n-r)!}.
\]
The factorial form is useful because it shows a clean “cancellation” idea: the \((n-r)!\) in the denominator removes the last
\((n-r)\) factors from \(n!\), leaving exactly the \(r\) factors you multiply in the product form.
With repetition: \(n^r\)
If repetition is allowed (you may reuse the same item again), then each of the \(r\) positions has \(n\) choices.
The multiplication principle gives:
\[
\text{Permutations with repetition} = n^r.
\]
This commonly models things like PIN codes, passwords, or sequences of rolls when outcomes can repeat.
The “order matters” part is still present: for example, the sequences \(AB\) and \(BA\) are counted as different.
Large values and approximations
Permutation counts grow extremely fast. Even moderate inputs can produce integers with hundreds or thousands of digits.
When the exact value becomes too large to print comfortably, it is common to report a scientific-notation form
and a digit estimate using logarithms. For factorial-based expressions, a standard approximation is Stirling’s approximation,
which (in logarithmic form) is:
\[
\ln(n!)\approx \left(n+\tfrac12\right)\ln n - n + \tfrac12\ln(2\pi).
\]
Using log forms keeps computations fast and numerically stable, while still providing an accurate magnitude and digit count.
How to use this tool
Enter integers \(n\) and \(r\), choose whether repetition is allowed, and click Calculate.
The calculator shows the formula, rewrites it as a product (like \(8\cdot7\cdot6\cdot5\cdot4\)), and evaluates the result.
If the exact integer is not too large, it is printed in full; otherwise, the output switches to scientific notation and logs.
The interactive canvas highlights the multiplication terms and shows a running product as you move the slider or press Play.
University extension: derangements count permutations where no element stays in its original position.
They connect to inclusion–exclusion and have the famous approximation \(!n \approx \frac{n!}{e}\),
showing how advanced counting blends exact formulas with asymptotic reasoning.