8. A natural number $n \geq 2$ is called resistant if it is coprime with the sum of all its divisors (1 and $n$ included). What is the maximum length of a sequence of consecutive resistant numbers?
Response: The maximum length of such a sequence is 5.

Solution: (Louis) In this type of problem, it is important to try small values of $n$ in the hope that it will give us ideas to solve the problem. We see that among the numbers between 2 and 30, the most resistant numbers are $2,3,4,5,7,8,9,11,13$, $16,17,19,21,23,25,27,29$. On the one hand, we observe that among these numbers, the longest sequence of consecutive resistant numbers is the sequence $2,3,4,5$, of length 4. The length we are looking for is therefore at least 4, and we need to determine whether there is a longer sequence somewhere. On the other hand, it seems that there are only a few pairs of resistant pairs. It is therefore interesting to study the number of pairs to see what is actually happening.

For an even number $n$ to be resistant, it is necessary (but not sufficient) that the sum of its divisors be odd. Clearly, the sum of the divisors of $n$ is odd if and only if $n$ has an odd number of odd divisors. One can write $n=2^{k} m$ with $m$ odd, and then the odd divisors of $n$ are the divisors of $m$. Thus, $m$ must have an odd number of divisors, in other words, $m$ must be a perfect square. Since $2^{k}$ is either a perfect square or twice a perfect square, we find that for an even number to be resistant, it must be of the form $n=s^{2}$ or $n=2 s^{2}$.

Because perfect pairs are very rare among all numbers, it is expected that it will be difficult to find many pairs of successive numbers that are resistant. Let's try to formalize this intuition:

If $n$ and $n+2$ are two even resistant numbers, they must both be of the form $s^{2}$ or $2 s^{2}$.

- If $n=s^{2}$ and $n+2=t^{2}$, we have $2=t^{2}-s^{2}=(t-s)(t+s)$, but since the two factors have the same parity, it is impossible for their product to be 2.
- If $n=2 s^{2}$ and $n+2=2 t^{2}$, we get $2=2 t^{2}-2 s^{2}$, which simplifies to $1=t^{2}-s^{2}=(t-s)(t+s)$, the only solution in this case is $s=0$, which is impossible since $n \geq 2$.

For $n$ and $n+2$ to be two even resistant numbers, one of them must be of the form $s^{2}$ and the other must be of the form $2 t^{2}$. Is it possible that $n+4$ is also resistant? By the previous remark, for this to be the case, $n$ and $n+4$ must both be perfect squares or both be twice a perfect square.

- If they are both perfect squares, we get $4=t^{2}-s^{2}=(t-s)(t+s)$, and since the two factors have the same parity, we must necessarily have $(t-s)=(t+s)=2$ and thus $s=0$, which is impossible.
- If they are both twice a perfect square, we get $2=t^{2}-s^{2}$, and we have already proven above that this case is impossible.

We therefore observe that it is impossible to find three consecutive even numbers that are all resistant. One therefore concludes that there can be no sequence of length 6 or more.

We now find ourselves in a situation where we know that the answer is 4 or 5, without being able to say which is the right answer. From there, there are two ways to continue the problem: either you try to find a sequence of length 5, or you try to prove that there is no sequence of length 5. In the present case, as there is a very strict condition on the form that the two pairs of numbers in the sequence must have, it is interesting to look for a sequence of length 5 first, and if you don't succeed, you can try to find out what is preventing us from finding a set of length 5, so that you can either reaffirm the values studied or show that this will never be possible.

In order to find such a sequence, we first need to find two natural numbers $a$ and $b$ such that $\left|a^{2}-2 b^{2}\right|=2$. Those who know the Pell equation can use the formula that gives all the solutions to the equation written above, but it is also possible to proceed by brute force, just trying all the numbers to find the first pairs $(a, b)$ that are solutions. Before starting to search, one can also realize that in order to have a solution, $a$ must be even and close to $\sqrt{2} b$, which reduces the number of pairs to be tested. Whatever the method used, we find that the first solutions $(a, b)$ are

$$
(2,1),(4,3),(10,7),(24,17),(58,41)
$$

The last pair is already difficult to find if you don't know the Pell formula, but this is not important because by trying the first 4 pairs, we find that $(24,17)$ gives the sequence $575,576,577,578,579$ and a quick calculation shows that these 5 numbers are all resistant, which concludes the proof.