Permutations with Replacement Calculator (n^r)

Calculate PR(n,r) = n^r, the number of ordered arrangements of r positions where each pick can repeat — PIN codes, passwords, license plates — with steps shown.

Loading calculator…

How to use this calculator

Enter n (how many symbols are available at each position) and r (how many positions you are filling). The calculator returns PR(n, r) = n^r — the number of ordered arrangements where repetition is allowed — along with the position-by-position reasoning.

Tip: If your problem forbids reusing an item once it's chosen — dealing cards, assigning distinct prizes — you want plain permutations (nPr) instead, not this calculator.

Repetition is allowed — the key difference from nPr

Ordinary permutations remove each chosen item from the pool, so nothing repeats. Permutations with replacement drop that rule: every position is filled independently from the full set of n symbols, so the same symbol can appear more than once. That's exactly how a PIN code works — the digit 7 can appear in position 1 and position 3 of the same code.

PR(n,r)=nrPR(n,r) = n^r

Each of the r positions has n independent choices, so the counts multiply: n × n × n × … (r times).

Worked example — a 3-digit PIN from 5 symbols

PR(5,3)=53=5×5×5=125PR(5,3) = 5^3 = 5 \times 5 \times 5 = 125

Position 1 has 5 possible digits, position 2 has the same 5 (a digit can repeat), and position 3 has the same 5 again — nothing is removed after a digit is used. Multiplying the three independent choices together gives 125 possible codes.

The four ways to sample r items from n

Whether repetition and order matter both change the counting formula. There are exactly four combinations:

Order mattersOrder doesn't matter
Without replacementPermutation: n!/(nr)!n!/(n-r)!Combination: n!/(r!(nr)!)n!/(r!(n-r)!)
With replacementPR(n,r)=nrPR(n,r) = n^rCR(n,r)=(n+r1r)CR(n,r) = \binom{n+r-1}{r}

This calculator handles the bottom-left cell — order matters and repetition is allowed. It's the only one of the four where r is free to exceed n, since you're never running out of symbols to reuse.

Why r can exceed n here

In ordinary permutations, rnr \le n is required — you cannot arrange more items than exist without reusing one. With replacement, that limit disappears: a 10-character password can still be built from a 5-letter alphabet, since each of the 10 positions independently draws from the same 5 letters. PR(5,10)=510=9,765,625PR(5,10) = 5^{10} = 9{,}765{,}625.

Common examples

  • 4-digit PIN, digits 0–9: PR(10,4)=104=10,000PR(10,4) = 10^4 = 10{,}000.
  • 6-character password, lowercase letters only: PR(26,6)=266=308,915,776PR(26,6) = 26^6 = 308{,}915{,}776.
  • License plate, 3 letters then repeats allowed: each letter position is an independent choice from 26.

All three share the same shape: r independent positions, each drawing from the same n-symbol alphabet, giving nrn^r total arrangements.

Frequently asked questions

What is 5^3 and why does it count PINs?
53=1255^3 = 125. A 3-digit PIN drawn from 5 possible symbols has 3 positions, and each position independently has 5 choices because digits can repeat, so the total is 5×5×5=1255 \times 5 \times 5 = 125.
What does 'with replacement' mean?
With replacement means a chosen item can be picked again at another position — nothing is removed from the pool after use. A 4-digit PIN allows 7-7-7-7 because each digit is chosen independently from the same full set of 10 digits every time.
How is this different from a regular permutation (nPr)?
Ordinary permutations P(n,r)=n!/(nr)!P(n,r) = n!/(n-r)! assume every chosen item is removed from the pool, so no value repeats and rr can never exceed nn. Permutations with replacement drop that restriction: any symbol can repeat at any position, so the count is simply nrn^r and rr can be larger than nn.
Why can r be bigger than n here but not in ordinary permutations?
Because repetition is allowed, you are not running out of distinct items to place — the same n symbols can be reused at every position. A 4-digit PIN (r = 4) drawn from 10 digits (n = 10) is fine, and even a 10-character password (r = 10) from a 5-letter alphabet (n = 5) works: 5105^{10}.
What real-world codes use permutations with replacement?
PIN codes, passwords built from a fixed character set, license plates, and lock combinations all allow repeated digits or letters, so their total count is nrn^r, not n!/(nr)!n!/(n-r)!.
How many 4-digit PIN codes are possible?
A standard 4-digit PIN uses digits 0–9 (n = 10) across 4 positions (r = 4), each chosen independently: 104=10,00010^4 = 10{,}000 possible PINs.
What is n^0?
Any n1n \geq 1 raised to the power 0 equals 1: there is exactly one way to fill zero positions — the empty arrangement, with nothing chosen.

Related calculators