4. Find all pairs of integers $(m, n)$ for which the value of the expression

$$
\frac{m+3 n-1}{m n+2 n-m-2}
$$

is a positive integer.
SOLUTION. First, we notice that the denominator of the fraction can be factored by successive extraction into the product $(m+2)(n-1)$. Therefore, it will be advantageous to set $a=m+2, b=n-1$ and for the new non-zero integer variables $a, b$ to examine when the value of the given expression

$$
V=\frac{m+3 n-1}{m n+2 n-m-2}=\frac{(a-2)+3(b+1)-1}{a b}=\frac{a+3 b}{a b}
$$

(as required by the problem) is a positive integer (let's use the usual term natural number). Let's present two possible approaches to solving such a question.

In the first method, we use the decomposition

$$
V=\frac{a+3 b}{a b}=\frac{1}{b}+\frac{3}{a}
$$

and the obvious estimates

$$
0 < \frac{1}{b}+\frac{3}{a} < 4 \quad \text{for} \quad a, b > 0.
$$

For $a>6$, $\frac{3}{a}<\frac{1}{2}$, which means $V<\frac{3}{2}$. This is satisfied by only one integer $b$, namely $b=1$, for which $1<V<\frac{3}{2}$. Therefore, we must have $1 \leq a \leq 6$. We will analyze these six possibilities individually:

$\triangleright a=1$. The number $V=3+\frac{1}{b}$ is an integer only for $b= \pm 1$, and it is positive only for $b=1$. In the original variables, we get two solutions $(m, n)=(-1,2)$ and $(m, n)=(-1,0)$.

$\triangleright a=2$. The number $V=\frac{3}{2}+\frac{1}{b}$ is a natural number only for $b= \pm 2$; the corresponding solutions are $(m, n)=(0,3)$ and $(m, n)=(0,-1)$.

$\triangleright a=3$. The number $V=1+\frac{1}{b}$ is a natural number only for $b=1$, then $(m, n)=(1,2)$.

$\triangleright a=4$. The number $V=\frac{3}{4}+\frac{1}{b}$ is a natural number only for $b=4$, then $(m, n)=(2,5)$.

$\triangleright a=5$. The number $V=\frac{3}{5}+\frac{1}{b}$ is clearly not an integer for any integer $b$.

$\triangleright a=6$. The number $V=\frac{1}{2}+\frac{1}{b}$ is a natural number only for $b=2$, then $(m, n)=(4,3)$.

Answer. There are exactly 7 pairs of integers $(m, n)$ for which the value of the given expression $V$ is a positive integer, they are the pairs

$$
(m, n) \in\{(-1,2),(-1,0),(0,3),(0,-1),(1,2),(2,5),(4,3)\}
$$