
1. Let $p>3$ be a prime. Find the number of ordered sextuples $(a, b, c, d, e, f)$ of positive integers, whose sum is $3 p$, and all the fractions

$$
\frac{a+b}{c+d}, \quad \frac{b+c}{d+e}, \quad \frac{c+d}{e+f}, \quad \frac{d+e}{f+a}, \quad \frac{e+f}{a+b}
$$

are integers.

(Jaromír Šimša, Jaroslav Švrček)


Solution. Taking the product of the 1st, the 3rd and the 5th fractions reveals that their value has to be 1 , that is

$$
a+b=c+d=e+f=p .
$$

the form of the second and of the fourth fraction implies

$$
f+a \mid d+e \text { and } d+e \mid b+c \text {. }
$$

that is first $f+a$ is at most the arithmetic mean of its multiples,

$$
f+a \leqslant \frac{1}{3}((f+a)+(d+e)+(b+c))=p,
$$

and

$$
f+a \mid(f+a)+(d+e)+(b+c)=3 p .
$$

Thus $f+a$ divides $3 p$ and is in the interval $\langle 2, p\rangle$. Consequently either $f+a=p$ or $f+a=3$. We deal separately with these cases.

(i) Let $f+a=p$. Because of (3) there is $f+a=d+e=b+c=p$, which together with (1) gives $p-1$ solutions of the form

$$
(a, b, c, d, e, f)=(a, p-a, a, p-a, a, p-a), \quad \text { where } a \in\{1,2, \ldots, p-1\}
$$

(ii) Let $f+a=3$. Then $\{a, f\}=\{1,2\}$.

Firstly let $a=1$ and $f=2$. According to (1) then $b=p-1$ and $e=p-2$, and (2) has the form

$$
3 \mid d+(p-2) \text { and } d+(p-2) \mid(p-1)+c \text {. }
$$

In analyzing (4) we distinguish between $d=1$ and $d \geqslant 2$.

If $d=1$ then $c=p-1$ and (4) reads

$$
3 \mid p-1 \quad \text { a } \quad p-1 \mid 2(p-1) .
$$

While the right relation always holds, the left one holds only for $p=3 q+1$ ( $q$ is a suitable positive integer). For such prime numbers we get considering (1) solutions

$$
(a, b, c, d, e, f)=(1, p-1, p-1,1, p-2,2) .
$$

If $d \geqslant 2$ we show first, that the right relation in (4) is satisfied if and only if $d+(p-2)=(p-1)+c$ or $d=c+1 . d \geqslant 2$ namely implies $c=p-d \leqslant p-2$, thus

$$
d+(p-2) \geqslant p \quad \text { and } \quad(p-1)+c \leqslant 2 p-33)$ : If $p=3 q+1$ then there are $p+2$ sextuples, if $p=3 q+2$, there are $p+1$ sextuples.
