“With replacement” changes a permutation problem in one of two ways, and this calculator handles both. Either each position can reuse any symbol — PIN codes, license plates, passwords — or the items being arranged include identical copies, like the letters of MISSISSIPPI. The first case gives the power nʳ; the second gives the multinomial count n! ÷ (n₁! n₂! ⋯). Both are computed exactly, with every digit kept.
How to use the permutations with replacement calculator
- Under What repeats?, choose Any item can be reused for codes and sequences, or Some items are identical for words and multisets.
- For reusable symbols, enter Choices per position (n) and Positions (r). Tick List the sequences to print up to 500 of them.
- For identical items, pick A word and type it, or pick Counts and enter how many of each kind there are, separated by commas.
- Read the count on the tape. The steps show the formula with your numbers, and the multiset mode adds a table of each symbol’s count.
Formulas
When every position can hold any of n symbols, the multiplication principle gives
When n items consist of k kinds with n₁, n₂, …, nk identical copies, arrange them as if all were different and then divide out the swaps of identical copies, which change nothing:
If every count is 1, this is just n!, the factorial. If there are only two kinds, it equals the binomial coefficient C(n, n₁).
Worked examples
A 4-digit PIN. n = 10 digits, r = 4 positions: 104 = 10 × 10 × 10 × 10 = 10,000 PINs.
The letters of MISSISSIPPI. 11 letters: M × 1, I × 4, S × 4, P × 2.
11! ÷ (1! · 4! · 4! · 2!) = 39,916,800 ÷ 1,152 = 34,650 distinct arrangements.
A shorter word shows why the division works. BANANA has six letters, so 6! = 720 orderings if the letters were all different. But the three A’s can be shuffled among themselves in 3! = 6 ways and the two N’s in 2! = 2 ways without changing the word, so each distinct arrangement was counted 12 times: 720 ÷ 12 = 60.
Codes and passwords: length beats alphabet size
Because the count is a power, adding positions grows it much faster than adding symbols:
| Code | Symbols (n) | Length (r) | Possible codes |
|---|---|---|---|
| PIN | 10 | 4 | 10,000 |
| PIN | 10 | 6 | 1,000,000 |
| Lowercase letters | 26 | 8 | 208,827,064,576 |
| Letters and digits | 62 | 8 | 218,340,105,584,896 |
| Lowercase letters | 26 | 12 | 95,428,956,661,682,176 |
Twelve lowercase letters beat eight mixed-case letters and digits by a factor of more than 400. That is why security guidance such as NIST’s favors long passphrases over short complicated ones. To build one, try the password generator; to explore bigger powers, the large exponents calculator prints them in full.
How many sequences have no repeats?
The tape also reports the share of sequences in which every symbol is different, P(n, r) ÷ nʳ. For a 4-digit PIN it is 5,040 ÷ 10,000 = 50.4%, so almost half of all PINs repeat a digit somewhere. The same calculation drives the birthday problem: with 365 possible birthdays, the share of 23-person groups with no shared birthday drops just below 50%.
Choosing between related calculators
If order does not matter — a handful of coins, scoops in a cup — the count is far smaller; use the combinations with replacement calculator. If nothing may repeat at all, use the permutations calculator for P(n, r).
Frequently asked questions
How many 4-digit PINs are there?
Each of the 4 positions can be any of the 10 digits, so there are 10⁴ = 10,000 PINs from 0000 to 9999. Only 5,040 of them, about 50.4%, use four different digits.
What is the difference between nʳ and nPr?
nʳ lets a symbol be used again in a later position; nPr does not. For 3 positions filled from 10 digits, nʳ = 1,000 while P(10, 3) = 720, because 280 of the 1,000 codes repeat at least one digit.
How many ways can the letters of MISSISSIPPI be arranged?
MISSISSIPPI has 11 letters: one M, four I's, four S's and two P's. The number of distinct arrangements is 11! ÷ (1! × 4! × 4! × 2!) = 39,916,800 ÷ 1,152 = 34,650.
Does the word mode treat uppercase and lowercase letters as different?
No. Letters are compared without regard to case and spaces are ignored, so 'Book' and 'BOOK' both count as B, O, O, K. Digits and punctuation count as symbols of their own.
What if I know how many of each item there are but not a word?
Choose Counts and type one number per kind, such as 3, 2, 2 for three red, two blue and two green beads. The answer is 7! ÷ (3! × 2! × 2!) = 210.