4. find all pairs $(a, b)$ of integers with different divisors such that

$$
a^{2}+a=b^{3}+b
$$
Solution: Since $a^{2}+a \geq-\frac{1}{4}$, we immediately have $b^{3}+b \geq 0$, so $b \geq 0$. The quadratic equation $a^{2}-a-b\left(b^{2}+1\right)=0$, if it has real solutions, always has one non-negative root and one non-positive root. Thus, without loss of generality, let's take $a \geq 0$ and find all solutions $(a, b)$ with $a, b \geq 0$. We will then see how to find the corresponding solution with $a \leq 0$.

We have $a(a+1)=b\left(b^{2}+1\right)$. Since $a$ and $b$ are coprime, $a \mid b^{2}+1$ and $b \mid a+1$. Multiplying these two relations, it follows that $a b \mid(a+1)\left(b^{2}+1\right)$, so $a b \mid b^{2}+a+1$.

- 1st case: $a \leq b$. Then $b^{3}+b \geq a^{3}+a \geq a^{2}+a$ with equality for $a=b=1$. The case $b=1$ gives us two solutions: $(a, b)=(1,1)$ and $(-2,1)$.
- 2nd case: $b=0$. Then we also have two solutions: $(a, b)=(-1,0),(0,0)$, which are not coprime.
- 3rd case: $a>b>1$. Then, since $a$ and $b$ are positive, $a b \leq b^{2}+a+1$, so for $b>3$, we have $a<b<b+2$, thus $a=b+1$. Since $b \mid a+1$, we have $b \mid 2$, and $b \leq 2$, which is a contradiction.

Thus, the only solutions are $(a, b)=(1,1),(-2,1),(-1,0),(5,3)$.