a) How many four-digit numbers have an even sum of their digits?

b) A number with two distinct and non-zero digits is called pretty if the tens digit is greater than the units digit. How many pretty numbers exist?

c) How many even four-digit numbers can we form using the digits $0,1,2,3,4,5$ without using the same digit twice?

d) What is the average of all five-digit numbers that can be formed using each of the digits $1,3,5,7$ and 8 exactly once?
Solution

a) For the sum to be even, we must use four, two, or no even digits. They can occupy the following orders: thousands, hundreds, tens, or units.

i) In the first case, zero cannot occupy the highest order, and the others can be occupied by any of the 5 even numbers, resulting in a total of

$$
4 \times 5 \times 5 \times 5=500 \text { numbers. }
$$

ii) In the second case, there are two formations, namely:

- When the first digit is odd, we have 5 options for the highest order. Then, we have 3 options to position the other odd digit. Separating the order of this digit, there are 5 options for odd numbers to be placed in the location, and in the remaining positions, any of the 5 even numbers can be placed. This generates

$$
5 \times 3 \times 5 \times 5 \times 5=1875 \text { numbers. }
$$

- When the first digit is even, once again, we exclude the possibility of zero occupying the highest order. There are three choices for the position of the other even number and 5 options for its value. The two remaining orders can be occupied by any of the 5 odd numbers, totaling

$$
4 \times 3 \times 5 \times 5 \times 5=1500 \text { numbers. }
$$

In the last case, when no digit is even, we have

$$
5 \times 5 \times 5 \times 5=625 \text { possibilities. }
$$

Thus, the total number is $500+1875+1500+625=4500$.

b) Starting with 9, we have the set of nice numbers $\{98,97, \ldots, 90\}$, which contains 9 numbers. Starting with 8, we have $\{87,86, \ldots, 80\}$, which contains 8 numbers, and so on until the set of those starting with 1, which is $\{10\}$. Thus, we have a total of $9+8+$ $7+\cdots+2+1=45$ numbers.

c) There are only three even digits, and the count can be divided into two cases: if the last digit is zero, we have $5 \times 4 \times 3=60$ possibilities; if the last digit is not zero, we have $4 \times 4 \times 3 \times 2=96$. Therefore, the total number of numbers is $60+96=156$.
d) Fixing a digit from the list, it will appear in a given order in $4 \cdot 3 \cdot 2 \cdot 1=24$ numbers. Each time a number appears in a given order, its contribution to the total sum is equal to its product by the power of 10 associated with that order. For example, in the numbers 13578 and 13857, the contribution of 5 is $5 \cdot 10^{2}$ and 5 . $10^{1}$, respectively. Since every number appears the same number of times in each order, the contribution of each digit to the total sum is equal to its product by $24 \cdot\left(10^{4}+10^{3}+10^{2}+10^{1}+10^{0}\right)=24 \cdot 11111$. In addition, the total number of numbers is $5 \cdot 4 \cdot 3 \cdot 2 \cdot 1=120$. Therefore, the average is

$$
\frac{(1+3+5+7+8) \cdot 24 \cdot 11111}{120}=53332.8
$$