What is a permutation with replacement?
A permutation with replacement counts the number of ordered sequences of length r that you can build from a set of n distinct objects when (1) the order of the items matters and (2) each object can be selected more than once. Picture an alphabet of n letters; a permutation with replacement of length r is simply any "word" of length r you can spell from that alphabet. This calculator returns that count using the formula \(P^{R}(n, r) = n^{r}\).
How to use the calculator
Enter n, the number of distinct objects available (the population), and r, the length of the ordered sample you want to form. Both must be non-negative integers. Press calculate and you get the total number of possible ordered sequences. Because the count grows exponentially, very large answers are shown in scientific notation.
The formula explained
Each of the r positions in the sequence is filled independently, and because replacement is allowed every position can take any of the n values. By the multiplication principle the total is \(n \times n \times \ldots \times n\) with r factors, which equals \(n^{r}\). This is different from permutations without replacement, \(P(n, r) = \frac{n!}{(n - r)!}\), where each object can be used at most once.
Worked example
With an alphabet {a, b, c, d} we have \(n = 4\). How many ordered pairs of length \(r = 2\) exist? $$P^{R}(4, 2) = 4^{2} = 16$$ aa, ab, ac, ad, ba, bb, ... , dd. For a longer string, $$P^{R}(4, 20) = 4^{20} = 1{,}099{,}511{,}627{,}776 \approx 1.0995 \times 10^{12}.$$
FAQ
What happens when r = 0? \(n^{0} = 1\) for any n — there is exactly one empty sequence. By convention this calculator also treats \(0^{0}\) as 1.
What if n = 0 and r > 0? \(0^{r} = 0\): with no objects to choose from there are no non-empty sequences.
When should I use this instead of combinations? Use permutations with replacement when order matters and repeats are allowed, such as PIN codes, dice-roll sequences, or character strings. Use combinations when order does not matter.