4. The difference between the product and the sum of two different integers is equal to the sum of their GCD (greatest common divisor) and LCM (least common multiple). Find all these pairs of numbers. Justify your answer.
4. Let the integers be $x$ and $y$ and assume that $x>y$. First we note that $x$ and $y$ are both nonzero and that their GCD and LCM are both positive by definition. Let $M$ be the GCD, then $|x|=M a$ and $|y|=M b$, where $a$ and $b$ are coprime integers. Thus the LCM of $x$ and $y$ is Mab. If $y=1$, then $M=1$ and it's easily checked that there is no solution. When $y>1, x y>x+y$. Thus $x y-(x+y)=M+M a b$. After substituting for $x$ and $y$ and simplifying, we have
$$
a b(M-1)=1+a+b \quad \Rightarrow \quad M=1+\frac{1}{a}+\frac{1}{b}+\frac{1}{a b} \quad \Rightarrow \quad 10>y$. Then $x=M a$ and $y=-M b$. Using similar arguments, we get $x+y-x y=M+M a b$. Thus $M=1+\frac{1}{a b}+\frac{1}{a}-\frac{1}{b}$ which yields $1 \leq M \leq 2$. When $M=1$, we get $a=1+b$. Thus the solutions are $b=t$, $a=1+t$ or $x=1+t, y=-t$, where $t \in \mathbb{N}$. When $M=2$, the equation simplifies to $(a-1)(b+1)=0$. Thus we get $a=1$ and $b$ arbitrary as the only solution. The solutions are $x=2, y=-2 t$, where $t \in \mathbb{N}$.
Finally, we consider the case $0>x>y$. Here $x=-M a, y=-M b$ and $M^{2} a b+$ $M a+M b=M+M a b$. Since $M 2 a b \geq M a b$ and $M a+M b>M$, there is no solution.
Thus the solutions are $(6,3),(6,4),(1+t,-t)$ and $(2,-2 t)$ where $t \in \mathbb{N}$.