# Sum of all possible combinations

Guys I just discovered something amazing. Can someone please confirm this? The sum of all possible ways to form a number with $n$ digits, using its digits, without repetition, is equal to $11\ldots1\cdot m(n-1)!$, where $m$ is the sum of the digits of the number, and the amount of $1$'s is equal to $n$. For example, $123$ can be arranged $132, 231, 213, 312, 321$. The sum of these numbers is equal to $1332$. $(111)(6)(2)$. I'll be waiting for my Fields Medal.

• This assumes the digits are distinct, or else count different instances of the same digit as distinct. – Robert Israel Nov 11 '16 at 23:23
• Yes, I forgot to mention that. – Diego Balvin Nov 11 '16 at 23:24
• The number $1\cdots 1$ is no surprise. The unit-digits,ten-digits, and so on , are all added to equal sums. – Peter Nov 11 '16 at 23:29
• Yeah, but it's cooler if you write it 1...1. – Diego Balvin Nov 11 '16 at 23:31
• "amazing" and "surprising" are pretty subjective words – Diego Balvin Nov 11 '16 at 23:39

Let's take your example of 123.

$123$
$132$
$213$
$231$
$312$
$321$

Let's look at the first digit (the hundreds' place). Since the number of digits is $3$, there will be $3 - 1 = 2$ digits after the first digit. Thus, there will be a total of $(3 - 1)! = 2! = 1$ numbers with each digit as the first.

Thus, the sum of the digits that occur in the hundreds' place (note: all of the digits show up as the first digit) is equal to the sum of the digits, and each digit shows up $(N - 1)!$ times.

Thus, the sum of all of the first-digits is $(digitsum)(N - 1)!$.

It follows that this applies to all of the digits.

Thus, the sum of all of the numbers is $(1\times{digitsum}) + (10\times{digitsum}) + (100\times{digitsum}) + ... + (10^N\times{digitsum})(N - 1)! = 11...11\times{digitsum})(N - 1)!$

QED

• you forgot (N-1)! in last formula – G Cab Nov 11 '16 at 23:59
• @GCab Whoops. Thanks for pointing that out! – HyperNeutrino Nov 12 '16 at 0:06

Each digit has a "chance" to "occupy" every column.

Hence the sum is that digit multiplied by $\underbrace{111\cdots 1}_n$.

Each column will be occupied by every digit, which when summed, gives $m$ for that column.

...Multiply by $m$ to give $\underbrace{111\cdots 1}_n\cdot m$

When a given column occupies a given position, other digits permute amongst themselves in $(n-1)!$ ways, so the number of times it occupies that column is $(n-1)!$.

...Multiply by $(n-1)!$ to give $\color{red}{\underbrace{111\cdots 1}_n\cdot m (n-1)!}$

It's interesting, though not particularly deep. You can just consider the expression for each place of the number (call it $x$). So we first consider the ones' place. If $x$ has decimal representation $x_1x_2\ldots x_n$, then each $x_i$ appears in the ones' place in $(n-1)!$ ways, since if I fix $x_i$ in the ones' place, there are $(n-1)!$ ways to arrange the other $n-1$ digits. This gives $x_1(n-1)!+x_2(n-1)!+\cdots+x_n(n-1)!=(x_1+x_2+\cdots+x_n)(n-1)!$. I'll call $m$ the sum of the digits. I then multiply this by $1$ because it takes the ones' place. I can do the same for the tens' place digit, which gives the same value, but I multiply that by $10$. This goes on for each digit until I have $m(n-1)!+10m(n-1)!+\cdots+10^{n-1}m(n-1)!$ which is exactly what you have.

• Thanks dude. I'll be sure to give you a cut of my \$15,000 prize – Diego Balvin Nov 11 '16 at 23:55
• @DiegoBalvin Don't I get anything? :( (; – HyperNeutrino Nov 11 '16 at 23:56