PROBLEM 4. For $n \in \mathbb{N}^{*}$, we denote by $f(n)$ the number of pairs $(x, y)$ with $x$, $y \in \mathbb{Z}$ and $\left|x^{2}-y^{2}\right|=n$.

a) Calculate $f(2013)$.

b) Calculate $f(n)$ for $n \in \mathbb{N}^{*}$.

NOTE: Working time 3 hours.

All subjects are mandatory.

Each subject is graded from 0 to 7 points.
![](https://cdn.mathpix.com/cropped/2024_06_07_d71d004b804b254a3430g-2.jpg?height=256&width=1700&top_left_y=102&top_left_x=295)

## MATHEMATICAL OLYMPIAD  LOCAL STAGE
## PROBLEM 4.

For $a, b \in \mathbb{Z}$, we denote by $\mathrm{S}(\mathrm{a}, \mathrm{b})$ the system $\left\{\begin{array}{l}x-y=a \\ x+y=b\end{array}\right.$. We claim that:

(i) $\mathrm{S}(\mathrm{a}, \mathrm{b})$ has a unique solution $\Leftrightarrow \mathrm{a}$ and $\mathrm{b}$ have the same parity.

(ii) $\mathrm{S}(\mathrm{a}, \mathrm{b})$ has no solutions $\Leftrightarrow \mathrm{a}$ and $\mathrm{b}$ have different parities.

(iii) $S(a, b)$ and $S(c, d)$ have the same solution $\Leftrightarrow a=c$ and $b=d$.

$$
\left|x^{2}-y^{2}\right|=n \Leftrightarrow|x-y| \cdot|x+y|=n \Leftrightarrow\left\{\begin{array}{l}
|x-y|=d \\
|x+y|=d'
\end{array}\right.
$$

where $dd'=n$. The solutions to the above system are obtained by solving the systems $S(d,d')$, $S(-d,d')$, $S(d,-d')$, $S(-d,-d')$. The number of all these systems is $4 \tau(n)$, where $\tau(n)$ represents the number of divisors of $n$.

According to the above claims, these systems will provide a solution only if $d$ and $d'$ have the same parity. We have three cases:

$\bullet n=4 k+2 \Leftrightarrow$ any $d$ and $d'$ have different parities, so $\mathrm{f}(\mathrm{n})=0$

$\bullet \mathrm{n}=\mathrm{odd} \Leftrightarrow$ any $d$ and $d'$ are odd, so $\mathrm{f}(\mathrm{n})=4 \tau(n)$.

$\bullet \mathrm{n}=4 \mathrm{k} \Rightarrow \mathrm{d}$ and $\mathrm{d}'$ are even, $\mathrm{d}=2 \mathrm{~s}$ and $\mathrm{d}'=2 \mathrm{~s}', \mathrm{so} \frac{n}{4}=s s'$, hence $\mathrm{f}(\mathrm{n})=4 f\left(\frac{n}{4}\right)$.

Note. If $n=p_{1}^{l_{1}} \cdot p_{2}^{l_{2}} \cdot \ldots \cdot p_{q}^{l_{q}}$ then $\tau(n)=\left(l_{1}+1\right)\left(l_{2}+1\right) \ldots\left(l_{q}+1\right)$.
![](https://cdn.mathpix.com/cropped/2024_06_07_d71d004b804b254a3430g-4.jpg?height=250&width=808&top_left_y=110&top_left_x=297)

MINISTRY OF EDUCATION

NATIONAL

![](https://cdn.mathpix.com/cropped/2024_06_07_d71d004b804b254a3430g-4.jpg?height=249&width=258&top_left_y=106&top_left_x=1736)

Since 2013 is odd and has the factorization 2013 $=3 \cdot 11 \cdot 61$, we have $f(2013)=4 \tau(2013)=32$. (3 points are awarded for the correct calculation of $f(2013)$)