2. Find all such triples of prime numbers $p, q$ and $r$, that $\frac{p}{q}=\frac{8}{r-1}+1$.
Answer: $(7,3,7); (5,3,13); (3,2,17)$.

First solution. Rewrite the relation as

$$
8 q=(p-q)(r-1)
$$

If $q=2$, it becomes $16=(p-2)(r-1)$. Then $p-2$ is a power of two, so $p=3$ and $r=17$. If $r=2$, the relation $(*)$ becomes $8 q=p-q$, from which $p=9 q$, which is impossible. We will further assume that $q$ and $r$ are odd prime numbers. But then the prime number $p$ is also odd, otherwise the left side of $(*)$ is negative. Therefore, $r-1$ and $p-q$ are even numbers, so $p-q=2$ and $r-1=4 q$ or $p-q=4$ and $r-1=2 q$. If $q=3$, in the first case $p=5$ and $r=13$, and in the second case $p=r=7$. Thus, we can assume that $q>3$. Consider the first case. Since $p$ and $q$ are not divisible by 3 and $p=q+2$, $q$ has the form $3 k+2$, but then $r=4 q+1=12 k+9$, which is impossible. Consider the second case. Since $p$ and $q$ are not divisible by 3 and $p=q+4$, $q$ has the form $3 k+1$, but then $r=2 q+1=6 k+3$, which is also impossible.

Second solution. From the condition, it follows that $p>q$. Multiply by the denominators and rewrite the relation as $7 q+p=(p-q) r$. From this, in particular, we get that $7 q+p$ is divisible by $p-q$. Therefore, $8 q=(7 q+p)-(p-q)$ is also divisible by $p-q$. On the other hand, $8 p=(7 q+p)+7(p-q)$ is also divisible by $p-q$. Thus, $p-q$ divides the greatest common divisor of the numbers $8 p$ and $8 q$, but this divisor is 8. Therefore, only three cases are possible: $p-q=1, p-q=2, p-q=4$ and $p-q=8$. Note immediately that in the last three cases $p \geqslant q+2 \geqslant 4$ and, in particular, $p$ is not divisible by three.

The first case is possible only when $p=3$ and $q=2$, and then $r=17$, which is the first solution.

In the second case, $p-q=2$ and then $r=\frac{1}{2}(7 q+p)=4 q+1=4 p-7$. If $r$ gives a remainder of 2 when divided by three, then $p$ will be divisible by three, which is impossible. If $r$ gives a remainder of 1 when divided by three, then $q$ will be divisible by three and, therefore, $q=3, p=5$ and $r=5$, which gives the second solution.

In the third case, $p-q=4$ and then $r=\frac{1}{4}(7 q+p)=2 q+1=2 p-7$. If $r$ gives a remainder of 2 when divided by three, then $p$ will be divisible by three, which is impossible. If $r$ gives a remainder of 1 when divided by three, then $q$ will be divisible by three and, therefore, $q=3, p=7$ and $r=7$, which is the third solution.

In the fourth case, $p-q=8$ and then $r=\frac{1}{8}(7 q+p)=q+1=p-7$. If $r$ gives a remainder of 2 when divided by three, then $p$ will be divisible by three, which is impossible. If $r$ gives a remainder of 1 when divided by three, then $q$ will be divisible by three and, therefore, $q=3$ and $r=4$, which is impossible.