Find the positive integers pair $(x, y)$ such that $xy^2 + y + 1 \mid x^2y + x + y$. 
Find the positive integers pair $(x, y)$ such that $xy^2 + y + 1 \mid x^2y + x + y$.

We have that $xy^2 + y + 1 \mid x^2y + x + y \implies xy^2 + y + 1 \mid y(x^2y + x + y) - x(xy^2 + y + 1)$
$\iff xy^2 + y + 1 \mid y^2 - x \implies xy^2 + y + 1 \mid xy^2 + y + 1 - x(y^2 - x)$
$\iff xy^2 + y + 1 \mid x^2 + y + 1 \implies xy^2 + y + 1 \le x^2 + y + 1$
$\iff xy^2 \le x^2 \iff y^2 \le x$. And I don't know what to do next.
This problem is adapted from a recent competition.
 A: We know that $(xy^2+y+1) \mid (x^2y+x+y)$. Let $k \in \mathbb{N}$ s.t. $$(x^2y+x+y)=k(xy^2+y+1)$$
We can  rewrite this expression as a quadratic in $x$:
$$yx^2+(1-ky^2)x+(-ky-k+y)=0$$
Now, we can see that the discriminant is:
$$\Delta = (ky^2-1)^2+4y(ky+k-y)=(ky^2+1)^2+4y(k-y)$$
We can see that the discriminant must be a perfect square. However:
$$(ky^2)^2 \geqslant (ky^2+1)^2+4y(k-y) \implies 4y(y-k) \geqslant 2ky^2+1 \tag{1}$$
$$(ky^2+2)^2 \leqslant (ky^2+1)^2+4y(k-y) \implies 4y(k-y) \geqslant 2ky^2+3 \tag{2}$$
However, for $k \geqslant 2$ and $y \geqslant 2$, we have:
$$2ky^2 \geqslant 4y^2 \tag{3}$$
$$2ky^2 \geqslant 4ky$$
Thus, we have:
$$2ky^2+3 > 2ky^2+1 > 2y^2 \geqslant 4y \cdot \mathrm{max}(k,y) \geqslant 4y|k-y|$$
Thus, we either have $k=1$, $y=1$ or $(ky^2)^2 < \Delta (ky^2+2)^2 \implies \Delta = (ky^2+1)^2 \implies y=k$.
$(i)$ $k=1$
We have: $$x^2y+x+y=xy^2+y+1 \implies x^2y+x=xy^2+1 \implies x \mid 1 \implies x=1$$
Thus, we have:
$$y+1=y^2+1 \implies y=1$$
This gives us the solution $(x,y)=(1,1)$ for $k=1$.
$(ii)$ $y=1$
We have: $$x^2+x+1=x+2 \implies x=1$$
This gives us the same solution as before.
$(iii)$ $k=y$
From our previous quadratic:
$$x=\frac{ky^2-1 \pm \sqrt{\Delta}}{2y}=\frac{(y^3-1) \pm (y^3+1)}{2y}>0 \implies x=y^2$$
This gives us the solution $(x,y)=(t^2,t)$ for any $t \in \mathbb{N}$. This also includes $(x,y)=(1,1)$, which is our other solution.
Thus, the only possible pairs of positive integers $(x,y)$ such that $(xy^2+y+1) \mid (x^2y+x+y)$ are all pairs: $$(x,y)=(t^2,t) \space \forall \space t \in \mathbb{N}$$
A: You have obtained that $xy^2+y+1 \mid x^2+y+1$, so $x \geq y^2$.
If $x=y^2$, then obviously all pairs of the form  $(k^2,k) $ are solutions.
If $x >y^2$, then we let $x=My^2+N$ with $N<y^2$. If $N=0$ then $x=My^2$ so $My^4+y+1 \mid M^2y^4+y+1$ and so $My^4+y+1 \mid My+M-y-1$, which is impossible due to bounding reasons. So $N \geq 1$
Then substituting, we obtain $My^4+Ny^2+y+1 \mid M^2y^4+2MNy^2+y+1+N^2$.
Obviously, $My^4+Ny^2+y+1 \mid M^2y^4+MNy^2+My+M$, so we obtain $My^4+Ny^2+y+1 \mid MNy^2+y+1+N^2-My-M$.
We claim that $MNy^2+y+1+N^2-My-M \geq 0$.
It suffices to show that $MNy^2+y+1+N^2 \geq My+M$.
That's almost obvious, since $MNy^2+y+1+N^2 \geq My^2+y+2 \geq M(y+1)=My+M$ for $y >1$. If $y=1$, then from the initial divisibility we obtain $x=1$, which is a solution that we have obtained before.
So, the claim is proved and :
Since $My^4+Ny^2+y+1 \mid MNy^2+y+1+N^2-My-M$, we have that $My^4+Ny^2 \leq MNy^2-N^2-My-M$, so $MNy^2 \geq My^4 \Rightarrow N \geq y^2$ a contradiction
Finally, all solutions are of the form $(k^2,k)$ with $k$ an integer.
A: OP did most of the work by showing that

*

*$xy^2 + y + 1 \mid x - y^2$.

*$ xy^2 + y+ 1 \mid x^2 + y + 1 $

*Since $x^2 + y + 1 > 0$ hence $x^2 + y + 1 \geq xy^2 + y + 1$ so $x \geq y^2$.

To complete the solution using these ideas, suppose $ x - y^2 > 0 $, then $ x-y^2 \geq xy^2 + y + 1$.
We can verify that this is not possible for any positive integer $y$, since $xy^2 + y + 1 > xy^2 \geq x > x - y^2$.
Hence, we must have $ x - y^2 = 0$.
Plugging this back in, we observe that all $ x = y^2$ are solutions to the divisibility condition.
