Why a 4-digit PIN is not a simple permutation of 10 digits
The basic permutation formula forbids reuse. Codes usually allow a digit to appear more than once, so they use a different counting model.
Permutation and combination calculator →Count reusable choices position by position
A four-character numeric code allowing any digit 0–9 at each position has 10×10×10×10 = 10,000 possibilities, including leading zeros. The permutation calculator instead gives P(10,4)=5040 for four distinct digits without replacement. The difference is the repeat rule, not a flaw in either formula. State whether strings such as 0011 or 7777 are permitted before counting.
Leading-zero restrictions change the model
A four-digit whole number cannot begin with zero. If repetition is allowed, there are 9 choices for the first digit and 10 for each remaining digit: 9000 numbers. If all digits must be different, there are 9×9×8×7 = 4536. A fixed-length code and an ordinary integer may look similar while having different allowable outcomes.
Do not force an incompatible input
Use the scientific calculator for the multiplication or power when choices are reusable. Do not put an inflated n into the permutation tool to imitate repeated selection. Real authentication systems also have lockouts, rate limits and storage requirements; a count of possible strings alone does not establish security. For a password, use the dedicated generator rather than constructing a reusable short code from this counting example. The leading-zero rule should be stated explicitly whenever a code is described simply as having four digits.
Try the calculators
- Permutation and combination calculator
Count ordered and unordered selections of r objects from n distinct objects.
- Random number
Generate a random integer in an inclusive range.
- Scientific calculator
Arithmetic, powers, trigonometry and logarithms.