5. For the set of non-negative integers, solve the equation

$$
p^{3}+41=7\left(7 q!-r^{3}\right)
$$

## First grade - B category
5. Answer: the given equation has seven solutions, and they are

![](https://cdn.mathpix.com/cropped/2024_06_04_f254ba4f25ce7f8d9df1g-41.jpg?height=425&width=601&top_left_y=230&top_left_x=860)

Ok 2017 4A 4

$$
(p, q, r) \in\{(1,0,1),(1,1,1),(1,2,2),(2,0,0),(2,1,0),(4,3,3),(18,5,1)\}
$$

We will consider the given equation modulo 9. For $q \geqslant 6$, we have $9 \mid q!$. Then it must hold that $p^{3}+5 \equiv -7 r^{3} \equiv 2 r^{3} (\bmod 9)$. The remainders of cubes when divided by 9 can only be 0, 1, or 8 (which can be directly verified). Therefore, the left side of the previous relation is congruent to 5, 6, or 4 modulo 9, while the right side is congruent to 0, 2, or 7. From this, we conclude that there are no solutions for $q \geqslant 6$.

For $q=0$, we have $q!=1$, so the given equation reduces to $p^{3}=7(7- r^{3})-41=8-7 r^{3}$. For the right side to be non-negative (since the left side is non-negative), it must hold that $r \leqslant 1$. For $r=0$, we get $p=2$, and for $r=1$, we get $p=1$. The same applies for $q=1$. This gives us a total of four of the seven solutions mentioned.

Consider the case $q=2$. Then the given equation reduces to $p^{3}=7(14- r^{3})-41=57-7 r^{3}$, from which we have $r \leqslant 2$. The only possibility is $r=2$ and $p=1$, giving us another solution. Similarly, for $q=3$, the right side of the given equation becomes $7(42-r^{3})$, so $r \leqslant 3$; it can be directly verified that for $r \in\{0,1,2\}$ there are no solutions, while for $r=3$ we have $p^{3}=7 \cdot (42-27)-41 = 7 \cdot 15-41 = 64$, i.e., $p=4$, giving us the sixth solution.

To slightly reduce the number of cases to be examined for $q=4$ and $q=5$, we will make certain conclusions by considering the given equation modulo 8. For $q \geqslant 4$, we have $8 \mid q!$, so we get $7(7 q!-r^{3}) \equiv -7 r^{3} \equiv r^{3} (\bmod 8)$, i.e., (considering the left side of the given equation) $p^{3}+1 \equiv r^{3} (\bmod 8)$. Note that for any even number $a$, $a^{3} \equiv 0 (\bmod 8)$, and for any odd number $a$, $a^{3} \equiv a (\bmod 8)$. From this, to satisfy the relation just derived, there are only two possibilities:

$p$ is an even number and $r \equiv 1 (\bmod 8)$, or $r$ is an even number and $p \equiv 7 (\bmod 8)$.

Now take $q=4$. From the condition $7 q!-r^{3} \geqslant 0$ we get $r^{3} \leqslant 7 \cdot 24 = 168$, i.e., $r \leqslant 5$. Additionally, we have $p^{3}=7(7 q!-r^{3})-41 < 49 q! = 1176$, i.e., $p \leqslant 10$. The first possibility from (*) directly gives $r=1$, i.e., $p^{3}=7(7 \cdot 24-1)-41=7 \cdot 167-41=1128$, so we do not get a solution here. The second possibility from (*) directly gives $p=7$, but then the left side of the given equation is not divisible by 7 while the right side is.

Finally, take $q=5$. Similarly as before, we get $r^{3} \leqslant 7 \cdot 120 = 840$, i.e., $r \leqslant 9$, and $p^{3} < 49 \cdot 120 = 5880$, i.e., $p \leqslant 18$. The first possibility from (*) gives $r=1$ or $r=9$; for $r=1$ we get $p^{3}=7(7 \cdot 120-1)-41=5832$, i.e., $p=18$, which is the seventh solution, and for $r=9$ we get $p^{3}=7(7 \cdot 120-729)-41=7 \cdot 111-41=736$, so there is no solution here. The second possibility from (*) gives $p=7$, which is impossible as already seen, or $p=15$, in which case we have $r^{3}=7 q!-\frac{p^{3}+41}{7}=7 \cdot 120-\frac{3375+41}{7}=840-488=352$, so there are no more solutions here.

## First Grade - B Category