# Sum of all $4$-digit numbers that can be formed with the digits $0,1,2,3$

What is the sum of all 4-digit numbers that can be formed with the digits 0,1,2,3 when repetition not allowed?

All I have been able to do is figure out that there will be $$18$$ such $$4$$ digit numbers ..but I am stuck and would like to know how we would proceed with this.

Also how would we approach this problem if repetition was allowed ?

• Hint: it's easier if you ignore the (implied) condition that the first digit can't be $0$ (why?). But then, you can just subtract off the sum of the three digit numbers made from $1,2,3$.
– lulu
Dec 25 '20 at 11:16
• Welcome to MSE. Please include your question in the body of the question, instead of putting it only in the title. Dec 25 '20 at 11:21

We'll find sums at each place (units, tens, etc.) and add them.

At thousands place each of $$1,2,3$$ occurs $$6$$ times. Sum is $$6(1+2+3)\cdot 1000=36000$$.

For hundreds place, we first look at numbers with thousands digit $$1$$. These are six numbers in which each of $$2,3,0$$ occurs twice. Hence in the $$18$$ nos, each of $$1,2,3$$ occurs $$4$$ times while $$0$$ occurs $$18-3\cdot 4=6$$ times as expected. Sum at hundreds place is $$4(1+2+3)\cdot 100=2400$$.

Sum at tens and units places are similar - $$240$$ and $$24$$ respectively.

Desired sum is $$36000+2400+240+24=38664$$.

The repetition case is exactly similar and probably easier.

We have $$3\cdot 4^3$$ nos in all, with $$4^3$$ starting with $$1,2,3$$ each. Sum at thousands place is $$4^3(1+2+3)\cdot 1000$$

For hundreds place, lets fix any digit as $$\square \, 0 \, \square \, \square$$ There'll be $$3\cdot 4^2=48$$ occurences of the fixed digit. Thus sum at hundreds place is $$48(0+1+2+3)\cdot 100$$.

Similarly at tens and units place - $$48(0+1+2+3)\cdot 10$$ and $$48(0+1+2+3)\cdot 1$$ resp.

Desired sum is $$(1+2+3)(64000 + 48\cdot 111) = 415968$$

For the no-repetition case:

In the units place, each of $$1,2,3$$ appear the same number of times as the number of $$3$$-digit numbers formed from $$0$$ and two other digits from $${1,2,3}$$, to contribute to a sum of $$(3!-2)(1+2+3)$$ The same thing goes for the tens and hundreds place : $$(3!-2)(10+20+30)+(3!-2)(100+200+300)$$

For the thousands place, fixing one digit there lends us $$3!$$ choices to arrange the other digits, as there is no restriction for $$0$$ now. This contributes a sum of $$3!(1000+2000+3000)$$ and adding the three expressions will give the answer.

For the repetition case:

Fix one of $$1,2,3$$ in the units place. We have $$4$$ choices for every other place except the thousands place, in which we have $$3$$ choices. This gives $$4^2\cdot 3(1+2+3)$$ Similarly for the tens and hundreds: $$4^2\cdot 3(10+20+30+100+200+300)$$

For the thousands place, fixing one digit lends us $$4^3$$ such numbers: $$4^3(1000+2000+3000)$$

• You are correct. Dec 25 '20 at 15:26

It would be easy to write down four blanks side by side, and then try to see how many possible choices could be filled in each block that would satisfy the condition.

      _____   ______  _____ _____


Check the different cases, for which repetition is allowed, and for repetition not being allowed.

For case 1, repetition being allowed, there are 3 choices for the first blank(0 not incuded), 4 for the next three. So total number of choices, as per counting principle, total= 3 * 4 * 4 * 4=192

For case 2, repetition not being allowed, there are 3 choices for the first blank, 3 for the next, 2 for the third, and 1 for the last. so total number of choices, total=3 * 3 * 2 * 1=18.

• The question is asking for the sum of those$18$ numbers. Dec 25 '20 at 11:36