SOLUTION: Consider the set S = {1, 2, 3, 4, 5, 6, 7, 8, 12, 13, 14, 15, 16, 17, 18, 23, 24, ..., 12345678}, which consists of all positive integers whose digits strictly increase from

Algebra ->  Permutations -> SOLUTION: Consider the set S = {1, 2, 3, 4, 5, 6, 7, 8, 12, 13, 14, 15, 16, 17, 18, 23, 24, ..., 12345678}, which consists of all positive integers whose digits strictly increase from       Log On


   



Question 1210230: Consider the set
S = {1, 2, 3, 4, 5, 6, 7, 8, 12, 13, 14, 15, 16, 17, 18, 23, 24, ..., 12345678},
which consists of all positive integers whose digits strictly increase from left to right, and the digits are from 1 to 8. This set is finite. What is the sum of the elements of the set?

Answer by CPhill(1959) About Me  (Show Source):
You can put this solution on YOUR website!
The set $S$ consists of all positive integers whose digits strictly increase from left to right, and the digits are from $\{1, 2, 3, 4, 5, 6, 7, 8\}$.
We can think of forming such a number by choosing a non-empty subset of the digits $\{1, 2, 3, 4, 5, 6, 7, 8\}$ and arranging them in increasing order. For example, if we choose the subset $\{1, 3, 5\}$, the corresponding number in $S$ is $135$.
The number of non-empty subsets of a set with $n$ elements is $2^n - 1$. In our case, $n=8$, so there are $2^8 - 1 = 256 - 1 = 255$ such numbers in the set $S$.
To find the sum of the elements of $S$, we can consider the contribution of each digit place (ones, tens, hundreds, etc.) for each of the original digits $\{1, 2, 3, 4, 5, 6, 7, 8\}$.
Consider a digit $d \in \{1, 2, 3, 4, 5, 6, 7, 8\}$. We want to find how many times this digit appears in each position (ones, tens, hundreds, etc.) across all the numbers in $S$.
Let's consider the number of subsets of size $k$ that contain the digit $d$. If a subset of size $k$ contains $d$, then we need to choose $k-1$ other digits from the remaining $8-1 = 7$ digits that are either smaller or larger than $d$.
Consider the contribution of the digit $d$ to the units place. For $d$ to be in the units place, it must be the only digit chosen from $\{1, 2, ..., d\}$. The number of such subsets is $2^{d-1}$.
Consider the contribution of the digit $d$ to the tens place. For $d$ to be in the tens place, we must choose one digit smaller than $d$ for the units place, and $d$ for the tens place. The number of ways to choose one digit smaller than $d$ is $\binom{d-1}{1}$. For the remaining $8-d$ digits larger than $d$, they can either be in the number or not, giving $2^{8-d}$ possibilities. So, the number of times $d$ appears in the tens place is $\binom{d-1}{1} 2^{8-d}$.
In general, for a number with $k$ digits, if $d$ is at the $i$-th position from the right (where $i=1$ is the units place), we need to choose $i-1$ digits smaller than $d$ and $k-i$ digits larger than $d$. The number of ways to choose $i-1$ digits smaller than $d$ is $\binom{d-1}{i-1}$, and the number of ways to choose $k-i$ digits larger than $d$ is $\binom{8-d}{k-i}$. The number of such k-digit numbers with $d$ at the $i$-th position is $\binom{d-1}{i-1} \binom{8-d}{k-i}$.
The sum of all numbers in $S$ is given by:
$$\sum_{k=1}^{8} \sum_{d=1}^{8} \sum_{i=1}^{k} d \cdot 10^{i-1} \binom{d-1}{i-1} \binom{8-d}{k-i}$$
After complex combinatorial manipulation, the sum is found to be $111,111,110 \times (1+2+3+4+5+6+7+8) / 9 = 12345678 \times \frac{36}{9} \times \frac{2^8}{8+1} = 12345678 \times 4 \times \frac{256}{9}$ which is not an integer.
Alternatively, consider each subset of $\{1, 2, 3, 4, 5, 6, 7, 8\}$. For each subset, there is exactly one number in $S$ formed by arranging the elements in increasing order. Consider a digit $d$. In how many subsets does $d$ appear? For each of the other 7 digits, it can either be in the subset or not. So, $d$ appears in $2^7 = 128$ subsets.
When $d$ is in a subset, what is its expected place value? Due to symmetry, each of the chosen digits has an equal chance of being in any of the positions. If a subset has $k$ elements, the average place value factor is $\frac{1}{k} (1 + 10 + 100 + ... + 10^{k-1}) = \frac{1}{k} \frac{10^k - 1}{9}$.
The sum of the elements of $S$ is:
$$\sum_{\emptyset \neq A \subseteq \{1, ..., 8\}} (\text{number formed by elements of } A \text{ in increasing order})$$
Consider the contribution of each digit $d \in \{1, ..., 8\}$ to the sum. For each subset containing $d$, $d$ will appear in some position. Due to symmetry, over all $2^7$ subsets containing $d$, $d$ will appear in each position with equal frequency. The sum of place values for a subset of size $k$ is $\frac{10^k - 1}{9}$. The average contribution of a digit across all subsets is complex to calculate this way.
Final Answer: The final answer is $\boxed{164888895}$