What This Calculator Does
The Permutations with Replacement Calculator counts how many ordered arrangements you can make when repetition is allowed. You choose from n types of items and fill r positions, and because each item type can be reused, every position has the same number of choices. The result is simply n raised to the power of r. This is the classic counting rule for situations like PIN codes, passwords, dice rolls, and license plates where the same value can appear more than once.
The Inputs You Provide
- Number of types of items (n): how many distinct options are available for each position — for example, 10 digits (0–9) or 26 letters.
- Number of positions to fill (r): how many slots you need to fill, such as 4 digits in a PIN.
Both inputs are read as whole numbers. The tool then returns the total count of possible ordered sequences.
The Formula
The calculation uses the permutations-with-replacement rule:
$$P(n, r) = n^{r}$$
The logic is straightforward: the first position can be any of n items, the second can also be any of n items (repetition is allowed), and so on for all r positions. Multiplying n by itself r times gives \(n^{r}\). Order matters here, so "AB" and "BA" count as different arrangements.
Worked Example
Suppose you want to count every possible 4-digit PIN. There are 10 digit types (0 through 9), so n = 10, and you fill 4 positions, so r = 4.
- \(P(10, 4) = 10^{4}\)
- \(= 10 \times 10 \times 10 \times 10\)
- = 10,000 possible PINs (from 0000 to 9999).
Enter n = 10 and r = 4, and the calculator returns 10,000.
How the Count Grows: Scenario Comparison
When repetition is allowed and order matters, each of the \(r\) positions can independently take any of the \(n\) item types, so the total number of ordered arrangements is \(P = n^r\). The table below shows how quickly that product grows in familiar settings.
| n (item types) | r (positions) | nr | Real-world context |
|---|---|---|---|
| 2 | 8 | 256 | One byte: 8 binary digits, each 0 or 1 |
| 6 | 2 | 36 | Two six-sided dice rolled in sequence (order distinguished) |
| 10 | 4 | 10,000 | 4-digit numeric PIN, 0000–9999 |
| 10 | 6 | 1,000,000 | 6-digit numeric PIN |
| 26 | 3 | 17,576 | 3-letter code from a 26-letter alphabet (AAA–ZZZ) |
| 36 | 6 | 2,176,782,336 | 6-character code using 10 digits + 26 letters (plate- or voucher-style) |
| 62 | 8 | 218,340,105,584,896 | 8-character password from digits + lowercase + uppercase (10 + 26 + 26 = 62 symbols) |
Two different levers drive this growth, and they are not equivalent:
- Adding one position multiplies the total by \(n\). Since \(n^{r+1} = n^r \times n\), going from a 4-digit PIN to a 5-digit PIN multiplies 10,000 by 10 to give 100,000 — a fixed factor per extra position.
- Adding item types raises the base. Going from \(n = 10\) to \(n = 36\) with \(r = 6\) fixed lifts the count from 1,000,000 to 2,176,782,336, because every one of the six positions gains the extra choices at once.
Because the exponent sits in the position count, lengthening a sequence is usually the more powerful lever: \(2^{8} = 256\) is tiny, while \(2^{64}\) is astronomically large from the same two symbols. Note that the alphabet sizes above (26 letters, 62 case-sensitive alphanumerics) assume the basic Latin alphabet used in English; other writing systems and code standards define different symbol sets, and any real password or licence-plate scheme may exclude confusable characters such as O and 0, which lowers \(n\).
Key Terms and Variables
| Term | Meaning |
|---|---|
| n — item types | The number of distinct items, symbols or outcomes available for each position. For a die \(n = 6\); for a decimal digit \(n = 10\). In this calculator \(n\) is the base of the power. |
| r — positions (draws) | The number of slots to fill, or draws to make, in sequence. Because items are replaced, \(r\) may be larger than \(n\): you can roll one die 20 times, so \(n = 6\), \(r = 20\). \(r\) is the exponent. |
| Replacement / repetition | An item type remains available after being used, so the same value can appear in more than one position. Every position therefore faces the same \(n\) choices, independently of the others. |
| Ordered arrangement (sequence) | Position matters: AB and BA are counted as two different outcomes. This is what distinguishes a permutation from a combination. |
| Permutation with replacement | The quantity this tool computes: $$P = n^{r}$$ Ordered, repetition allowed. |
| Permutation without replacement | Ordered, but each item can be used at most once, so choices shrink from \(n\) down to \(n-r+1\): $$P(n,r) = \frac{n!}{(n-r)!}$$ Requires \(r \le n\). With \(n = 10\), \(r = 4\) this gives \(10 \times 9 \times 8 \times 7 = 5{,}040\), far fewer than \(10^4 = 10{,}000\). |
| Combination without replacement | Unordered selection of \(r\) distinct items from \(n\): $$C(n,r) = \binom{n}{r} = \frac{n!}{r!\,(n-r)!}$$ Here \(\{A,B\}\) and \(\{B,A\}\) are the same outcome. |
| Combination with replacement | Unordered, repetition allowed ("multiset" selection): $$\binom{n+r-1}{r}$$ For two dice where only the pair of values matters, \(\binom{6+2-1}{2} = \binom{7}{2} = 21\), compared with \(6^2 = 36\) ordered outcomes. |
| Sample space | The complete set of all \(n^r\) possible sequences. If every sequence is equally likely, each has probability \(1/n^{r}\) — the basis for saying a random 4-digit PIN is guessed on the first try with probability \(1/10{,}000\). |
| Factorial (n!) | \(n! = n \times (n-1) \times \cdots \times 2 \times 1\), with \(0! = 1\) by convention. It appears in the without-replacement formulas above but not in \(n^r\). |
Quick test for which formula applies: ask (1) does order matter, and (2) can an item repeat. Order matters + repetition allowed \(\Rightarrow n^{r}\). Order matters + no repetition \(\Rightarrow n!/(n-r)!\). Order irrelevant + no repetition \(\Rightarrow \binom{n}{r}\). Order irrelevant + repetition allowed \(\Rightarrow \binom{n+r-1}{r}\).
Frequently Asked Questions
How is this different from regular permutations? Standard permutations without replacement use \(n!/(n-r)!\) because items can't repeat. With replacement, every position still has n choices, giving \(n^{r}\), which produces a larger count.
Does order matter in this calculation? Yes. Each arrangement is treated as an ordered sequence, so different orderings of the same items are counted separately. If order did not matter, you would use a combinations-with-replacement formula instead.
Can r be larger than n? Absolutely. Because items are reused, r can exceed n with no problem — for example, a 6-character code from 4 symbols gives \(4^{6} = 4{,}096\) results.
Related calculators
- Combinations Calculator — n choose r (nCr).
- Permutations Calculator — nPr from n and r.
- Combinations with Replacement — combinations with repetition.
- Permutations & Combinations — both nPr and nCr.
- Factorial Calculator — compute n!.