Exercise 3. Find all possible values for $f(2018)$ where $f$ is a function from $\mathbb{Q}$ to $\mathbb{R}_{+}$ satisfying the following three conditions:

- $f(2)=1 / 2$;
- for any rational $x$, if $f(x) \leqslant 1$, then $f(x+1) \leqslant 1$;
- $f(x y)=f(x) f(y)$ for all rational $x$ and $y$.
Solution to Exercise 3 First, the equality $1 / 2=f(2)=f(1 \times 2)=f(1) f(2)=f(1) / 2$ shows that $f(1)=1$, and thus that $f(n) \leqslant 1$ for any non-zero natural number $n$.

Furthermore, for all $x, y$ with $y \neq 0$ we have $f(y) \neq 0$, and $f(x / y)=f(x) / f(y)$ since $f(x / y) f(y)=f((x / y) y)=f(x)$. In particular, $f(1 / 2)=2$. Finally, for any rational $x$, we have $f(x)^{2}=f\left(x^{2}\right)=f(-x)^{2}$, so $f$ is even.

Let $k$ be an odd natural number, of the form $k=2 n+1$: we necessarily have $f(k) \leqslant 1$. We also know that $f(-k / 2)>1$, since $1 / 2=-k / 2+(n+1)$, so $f(-2 / k)=1 / f(-k / 2) \leqslant 1$, which implies that $f\left(\frac{k-2}{k}\right)=f\left(-\frac{2}{k}+1\right) \leqslant 1$, consequently $f(k-2) \leqslant f(k)$.

This allows us to show by induction that for all $k \geqslant 1$ odd we have $f(k) \geqslant 1$, and thus $f(k)=1$.

We deduce from all this that $f(2018)=f(2) f(1009)=1 / 2$.

Conversely, it remains to verify that a function $f$ as described in the statement does indeed exist. To do this, it suffices to observe that the function $f$ defined by

$$
f: p / q \mapsto \begin{cases}0 & \text { if } p=0 \\ 2^{v_{2}(q)-v_{2}(p)} & \text { if } p \neq 0\end{cases}
$$

where $v_{2}(n)$ denotes the 2-adic valuation of the integer $n$, satisfies the conditions of the statement.