6. determine all finite sequences $\left(x_{0}, x_{1}, \ldots, x_{n}\right)$ of real numbers so that the number $k$ occurs exactly $x_{k}$ times in the sequence.
## Solution

First note that all sequence members are non-negative integers $\leq n+1$, since $x_{k}$ counts the occurrence of $k$ in the sequence and the length of the sequence is $n+1$. Furthermore, $x_{k}=n+1$ is impossible, because otherwise all sequence members would be equal to $k$, i.e. also $x_{k}$, contradiction. Therefore, $x_{k} \leq n$ for all $k$. The sum of all sequential elements is equal to $0 \cdot x_{0}+1 \cdot x_{1}+\ldots+n \cdot x_{n}$, since exactly $x_{k}$ of these are equal to $k$. This provides

$$
\sum_{k=0}^{n} k x_{k}=\sum_{k=0}^{n} x_{k}
$$

For the following, always bear in mind that from $x_{l}=k>0$ it follows that $x_{k}>0$ applies. Furthermore, $x_{0}>0$, because $x_{0}=0$ cannot be. Now let $m$ be the largest number, so that $x_{m} \neq 0$. Then it follows in particular that $x_{k} \leq m$ for all $k$. Because of $x_{0} \neq 0$ is $m \geq 1$. Assuming $m=1$, then $x_{0}=x_{1}=1$, which is not possible. Therefore $m \geq 2$. The equation now follows from (1)

$$
x_{0}=x_{2}+2 x_{3}+\ldots+(m-1) x_{m}
$$

The right-hand side is at least equal to $(m-1) x_{m}$. Together with $x_{0} \leq m$ there are four possible cases: (a) $m=2, x_{0}=x_{2}=2$, (b) $m=2, x_{0}=x_{2}=1$, (c) $m \geq 3$, $x_{0}=m-1, x_{m}=1, x_{k}=0$ for $k \neq 0,1, m$ and (d) $m \geq 3, x_{0}=m, x_{2}=1, x_{m}=1$, $x_{k}=0$ for $k \neq 0,1,2, m$. We now consider these individually.

(a) $x_{1} \leq 1$ applies. $x_{1}=0$ provides the sequence $(2,0,2,0)$ and $x_{1}=1$ the sequence $(2,1,2,0,0)$.

(b) From $x_{2}=1$ follows $x_{1}=2$. This results in the sequence $(1,2,1,0)$.

(c) Because $x_{m}>0$, $m$ must occur in the sequence, therefore $x_{1}=m$. However, this would mean that $m \geq 3$ ones would have to be found in the sequence, which is not the case, contradiction.

(d) $x_{1}=2$, which leads to the sequence $(m, 2,1, \underbrace{0,0, \ldots, 0}_{m-3}, 1,0,0,0)$.

The solutions are therefore the three special sequences

$$
(1,2,1,0), \quad(2,0,2,0), \quad(2,1,2,0,0)
$$

and the infinite family

$$
(m, 2,1, \underbrace{0,0, \ldots, 0}_{m-3}, 1,0,0,0), \quad m \geq 3
$$