Connect via MCP →

Enter Calculation

For n ≥ 0 and r ≥ 0 (integers). Each of the n objects can be chosen repeatedly and order matters.

Formula

Formula: Permutations with Replacement Calculator
Show calculation steps (1)
  1. Empty sequence (r = 0)

    Empty sequence (r = 0): Permutations with Replacement Calculator

    There is exactly one ordered sequence of length zero, by convention, for any n (including 0^0 = 1).

Advertisement

Results

Permutations with Replacement PR(n, r)
16
ordered sequences
n (objects) 4
r (sample) 2
Formula nr

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}\).

Drawing items with replacement into ordered positions, each position can be any of the available items
With replacement, each ordered position can independently be any of the n items, since picks are returned to the pool.

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.

Advertisement
Each of r positions has n choices, multiplied together to give n to the power r
Each of the r positions independently offers n choices, so the total is n multiplied by itself r times: n^r.

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.

Last updated: