Average of all 6 digit numbers that contain only digits $1,2,3,4,5$ How do I find the average of all $6$ digit numbers which consist of only digits $1,2,3,4$ and $5$?
Do I have to list all the possible numbers and then divide the sum by the count? There has to be a more efficient way, right?
Thank you!
 A: Given any of our numbers $x$ except $333333$, call $666666-x$ the partner of $x$. Note that the partner of the partner of $x$ is $x$. So, apart from $333333$, our numbers come in couples.
The average of any two partners is $333333$, and the solitary number is $333333$, so the average of all the numbers is $333333$. 
A: It's actually very simple and I'll give you a few hints.
Think about only the ones digit. It can only contain either 1, 2, 3, 4, or 5. Now I want to average only one digit numbers. So what's the average over all one digit numbers that contain only 1, 2, 3, 4, and 5?
Once you answer that question, think about this question. Does anything change if we consider the 10s digit? Or the hundreds? In other words, if we can do it for the ones digit, let's exploit what we already know for all the other digits.
A: Don't want to completely give it away, but there are $5^6$ of these numbers as the first through sixth digits can all take on five different values.  I'm sure there's something slicker you could do, but it should be easy to then sum them all up by evaluating the sum
$$
\sum_{a=1}^5 \sum_{b=1}^5 \sum_{c=1}^5 \sum_{d=1}^5 \sum_{e=1}^5 \sum_{f=1}^5 (a \cdot 10^5+b \cdot 10^4+ c \cdot 10^3+d \cdot 10^2+ e \cdot 10^1 + f \cdot 10^0)
$$
and dividing by the total number of them.
A: $$(111111+111112+\cdots+555555)=$$
$$(100000\times 5^5+200000\times 5^5+\cdots+500000\times 5^5)+(10000\times 5^5+20000\times 5^5+\cdots+50000\times 5^5)+\cdots+(1\times 5^5+2\times 5^5+\cdots+5\times 5^5)$$
A: The digit $1$ will contribute $111,111\cdot 5^5$ to the sum of all such $6$ digit numbers.  Similarly, the digit $2$ will contribute $222,222\cdot 5^5$ to the sum.
Continuing, we obtain the sum:
$$(111,111+222,222+333,333+444,444+555,555)\cdot 5^5=3\cdot(555,555)\cdot5^5$$
Divide this by the total number of such $6$ digit numbers ($5^6$) to obtain an average of $333,333$.
A: The generating function of these numbers is
$$f(x) = \prod_{q=0}^5
\left(x^{10^q} + x^{2 \times 10^q}+ \cdots + x^{5 \times 10^q}\right).$$
Hence the number of values is given by
$$f(1) = \prod_{q=0}^5 5 = 5^6,$$
(this part is trivial but it confirms that we have the right generating function). 
Similarly, the sum of these numbers is given by
$$\left.\frac{d}{dx} f(x)\right|_{x=1} \\
= \left.\prod_{q=0}^5
\left(x^{10^q} + x^{2 \times 10^q}+ \cdots + x^{5 \times 10^q}\right) \\ \times
\sum_{q=0}^5 \frac{10^q \times x^{10^q-1} + 2\times 10^q \times x^{2 \times 10^q-1}+ \cdots + 5\times 10^q \times x^{5 \times 10^q-1}}
{x^{10^q} + x^{2 \times 10^q}+ \cdots + x^{5 \times 10^q}}
\right|_{x=1}$$
which is $$5^6 \frac{1}{5} \sum_{q=0}^5 10^q \times(1+2+\cdots+5),$$
so the average is
$$\frac{\left.\frac{d}{dx} f(x)\right|_{x=1}}{f(1)} =
\frac{1}{5} \times 15 \times \sum_{q=0}^5 10^q =
3\times 111111 = 333333.$$
