# How many four-digit natural numbers not exceeding the number $4321$ can be formed using the digits $1, 2, 3, 4$ if repetition is allowed?

How many four-digit natural numbers not exceeding the number $$4321$$ can be formed using the digits $$1, 2, 3, 4$$ if repetition is allowed?

This is the question and I am solving it like this:

Total no's can be formed - no's not allowed $$4 \cdot 4 \cdot 4 \cdot 4-11=256-11 =245$$, but the answer is $$229$$. What is wrong in this method?

And my second method is this: Total no. = no's digit do not repeat + no's in which $$2$$ digits are same + no's in which $$3$$ digit are same + no's in which all digit are same - no's not allowed

No repeat$$=4!$$

2 no's same$$= 144$$

3 same $$=48$$

4 same $$=4$$

Sum $$=220-11=209$$

What is wrong in both methods?

• Here is a similar question asked here math.stackexchange.com/questions/3483656/… Jan 24, 2022 at 11:14
• Welcome to MSE. A question should be written in such a way that it can be understood even by someone who did not read the title. Jan 24, 2022 at 11:15
• It is hard to discern what you did wrong since you have not explained how you obtained the $11$ numbers which are not allowed, the number with two identical digits, or the numbers with three identical digits. Jan 24, 2022 at 11:18

There are actually $$27$$ numbers larger than $$4321$$. They are:

Numbers of the form $$44\square\square$$: There are $$1 \cdot 1 \cdot 4 \cdot 4 = 16$$ such numbers.

Numbers of the form $$433\square$$ or $$434\square$$: There are $$1 \cdot 1 \cdot 2 \cdot 4 = 8$$ such numbers.

Numbers of the form $$432\square$$: There are $$3$$ such numbers, namely $$4322, 4323, 4324$$.

Hence, you should have $$4^4 - (16 + 8 + 3) = 256 - 27 = 229$$ in your first method.

In your second method, your forgot to count numbers in which two digits each appear twice, which is why your four cases do not add up to $$4^4 = 256$$. There are $$\binom{4}{2}$$ ways to select the two digits which each appear twice and $$\binom{4}{2}$$ ways to select two positions for the smaller of those digits. Hence, there are $$\binom{4}{2}\binom{4}{2} = 36$$ numbers which each appear twice.

Thus, you should have a total of $$24 + 144 + 36 + 48 + 4 = 256$$ numbers, of which $$27$$ are too large, again giving $$256 - 27 = 229$$ admissible numbers.

A direct count: We wish to count four-digit numbers formed using the digits $$1, 2, 3, 4$$ which are at most $$4321$$ when repetition of digits is permitted.

Numbers of the form $$1\square\square\square$$, $$2\square\square\square$$, or $$3\square\square\square$$: $$3 \cdot 4 \cdot 4 \cdot 4 = 192$$

Numbers of the form $$41\square\square$$ or $$42\square\square$$: $$1 \cdot 2 \cdot 4 \cdot 4 = 32$$

Numbers of the form $$431\square$$: $$4$$

The number $$4321$$: $$1$$

Hence, the numbers of admissible numbers is $$192 + 32 + 4 + 1 = 229$$.