Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

How many combinations for a 5 digit code using 3 numbers.

Writer Sophia Terry
$\begingroup$

Can anyone please help here? I have inherited a strange looking safe with only numbers 1 2 and 3. The code to open it is 5 digits and the code uses all three numbers at least once. Is there some formula I can apply to list all the combinations? Thanks

$\endgroup$ 1

4 Answers

$\begingroup$

Let $U$ be the set of all possible combinations with those three digits, $A$ the set of combinations that doesn't use $1$, combinations in $B$ doesn't use $2$, and in $C$ are the ones that don't use $3$. You're trying to find the number of elements of $U/(A\cup B\cup C)$ where / is difference of sets. It's easy to discover the size of $U$, it is $3^5$. If we discover the size of $A\cup B\cup C$ then we're done. We first observe that $\# (A\cup B\cup C) = \# A + \# B + \# C - \# (A \cap B) - \# (A \cap C) - \# (B \cap C) + \# (A \cap B \cap C)$, where $\#$ is the size of the set. Then we see that $\# A = \# B = \# C = 2^5$, and $\# (A \cap B) = \# (A \cap C) = \# (B \cap C) = 1$, the last thing is that $\# (A \cap B \cap C) = 0$ as there is no sequence that does not use any number. We conclude that there are $3^5 -3\times 2^5 + 3 = 150$ combinations.

$\endgroup$ $\begingroup$

If there were no restrictions, the number of five digit codes that could be formed with the digits 1, 2, 3 would be $3^5$ since there are three ways to choose each of the five digits. From these, we must exclude those codes in which fewer than three digits are used.

There are $\binom{3}{1}$ ways to exclude one of the digits and $2^5$ ways to form a five digit code using two numbers. Thus, there are $$\binom{3}{2}2^5$$ codes that use at most two numbers.

When we exclude those codes that have at most two numbers, we exclude those codes that use only one number twice, once each when we exclude the other two numbers. For instance, we exclude 11111 when we exclude those codes that do not include a 2 and exclude it again when we exclude those codes that do not include a 3. Therefore, we must add those codes that use only one of the numbers so that we only exclude them once.

There are $\binom{3}{2}$ ways to exclude two of the digits and $1^5$ ways to form a five digit code using one number. Thus, there are $$\binom{3}{2}1^5$$ codes that use one number.

By the Inclusion-Exclusion Principle, the number of five digit codes using each of the digits 1, 2, and 3 at least once is $$3^5 - \binom{3}{1}2^5 + \binom{3}{2}1^5$$

$\endgroup$ $\begingroup$

Much simpler is to just [choose numbers] $\times$ [permute them]

3-1-1 of a kind, e.g 22231: $\binom{3}{1,2}\times\frac{5!}{3!} = 60$

2-2-1 of a kind, e.g. 22113: $\binom{3}{2,1}\times\frac{5!}{2!2!} = 90$

yielding the answer of 150

$\endgroup$ $\begingroup$

Its easy see we can have repetition its just choosing 1 from 3 digits everytime now we want $5$ digits . Now for every digit we have single choices . So its $3.3.3.3.3=243$ Thats all.

$\endgroup$ 5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy