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!

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.$$
