19. N2 (AUS) ${ }^{\mathrm{IMO} 4}$ Determine all pairs $(m, n)$ of positive integers such that $\frac{n^{3}+1}{m n-1}$ is an integer.
19. Since \( m n-1 \) and \( m^{3} \) are relatively prime, \( m n-1 \) divides \( n^{3}+1 \) if and only if it divides \( m^{3}\left(n^{3}+1\right)=\left(m^{3} n^{3}-1\right)+m^{3}+1 \). Thus 
\[ \frac{n^{3}+1}{m n-1} \in \mathbb{Z} \Leftrightarrow \frac{m^{3}+1}{m n-1} \in \mathbb{Z} \]
hence we may assume that \( m \geq n \). If \( m=n \), then \( \frac{n^{3}+1}{n^{2}-1}=n+\frac{1}{n-1} \) is an integer, so \( m=n=2 \). If \( n=1 \), then \( \frac{2}{m-1} \in \mathbb{Z} \), which happens only when \( m=2 \) or \( m=3 \). Now suppose \( m>n \geq 2 \). Since \( m^{3}+1 \equiv 1 \) and \( m n-1 \equiv -1 \pmod{n} \), we deduce \( \frac{n^{3}+1}{m n-1}=k n-1 \) for some integer \( k>0 \). On the other hand, \( k n-1 < \frac{n^{3}+1}{n^{2}-1}=n+\frac{1}{n-1} \leq 2 n-1 \) gives that \( k=1 \), and therefore \( n^{3}+1=(m n-1)(n-1) \). This yields \( m=\frac{n^{2}+1}{n-1}=n+1+\frac{2}{n-1} \in \mathbb{N} \), so \( n \in \{2,3\} \) and \( m=5 \). The solutions with \( m<n \) are obtained by symmetry. There are 9 solutions in total: \( (1,2),(1,3),(2,1),(3,1),(2,2),(2,5),(3,5) \), \( (5,2),(5,3) \).