sum of all the numbers that can be formed using the digits 2,3,3,4,4,4..

How to find the sum of all the numbers that can be formed using the digits 2,3,3,4,4,4.. What should be the way of doing this type of problem?? Please guide


Solution 1:

I am assuming here that you only want permutations of this sequence: $(2,3,3,4,4,4)$

So for example numbers such as 233444, 234443 etc.

By symmetry, given each decimal position, each digit will appear at that position the same number of times in the set of all permutations of the sequence above.

How many times will it appear in that position? The amount of permutations of the rest of the digits in other positions, which is $\left(n-1\right)!$ given $n$ is the number of digits.

Sum this over all decimal positions so that for a digit $d$ the contribution to the total sum is $d\cdot\left(n-1\right)!\cdot\left(10^{0}+10^{1}+10^{2}+\dots+10^{n}\right)$

Then sum this over all digits so the sum is $\left(d_{1}+d_{2}+\dots+d_{n}\right)\cdot\left(n-1\right)!\cdot\left(10^{0}+10^{1}+10^{2}+\dots+10^{n}\right)$

Where the $d_{i}$ are the digitis. In this particular case the sum is (wait, this is not the final answer):

$\left(2+3+3+4+4+4\right)\cdot\left(6-1\right)!\cdot\left(111111\right)=266666400$

You need to compensate for the fact you are double/triple counting. For each sequence you count it twice as you can exchange the two 3's and it would stay the same. So you need to divide by $2!$. Similarly there are three 4's so you need to divide by $3!$ to compensate for that.

So you would get $\frac{266666400}{3!2!}=22222200$.

Now if you also want to consider numbers created from subsets of the above sequence, you can use this method to sum over all subsets. there are $2^n$ subsets for a set of cardinality $n$ so in this case it could be calculated on a computer, as $n$ is not too large (Though again you'll need to be careful not to consider duplicate subsets.)

Solution 2:

Let $(a_1,\ldots,a_6)=(2,3,3,4,4,4)$ and denote by $S_6$ the set of permutations of $\{1,\ldots,6\}$. We want to compute $$ S=\sum\left\{\sum_{i=0}^5a_{\sigma(i)}10^i\, \Biggm| \sigma\in S_6\,\right\} $$ where we must take care that every element of the set is added only once, even though several permutations $\sigma$ produce it. In fact, there are always $1!2!3!=12$ different permutations producing any one number. Then $$ 12S=\sum_{\sigma\in S_6}\sum_{i=0}^5a_{\sigma(i)}10^i = \sum_{i=0}^510^i\sum_{\sigma\in S_6}a_{\sigma(i)}. $$ Now the latter sum is independent of$~i$, and can be computed using Iverson brackets as $$ \sum_{\sigma\in S_6}a_{\sigma(i)} = \sum_{k=1}^6a_k\sum_{\sigma\in S_6}[\sigma(i)=k] =(2+3+3+4+4+4)|S_5| = 20\times 120 $$ so that $$ S=\frac{111111\times20\times120}{12} =22222200. $$