Given integers:
- $y>z>0$
- $w>0$
I want to calculate the minimum value of an integer $x$, such that $\left\lfloor\frac{xy^2}{xy+w(y-z)}\right\rfloor>z$.
I've figured that I can instead solve $xy^2=(xy+w(y-z))(z+1)$.
The solution I got is $x=\frac{w(yz-z^2+y-z)}{y^2-yz-y}+1$.
However, when I put it on a quick test, it fails for:
- $y=3$
- $z=1$
- $w=3$
As $x=\frac{w(yz-z^2+y-z)}{y^2-yz-y}+1=5$ solves $\left\lfloor\frac{xy^2}{xy+w(y-z)}\right\rfloor>z$, but $x=4$ also solves it.
Where did I go wrong?
$$xy^2=(xy+w(y-z))(z+1)$$
$$xy^2-xy*(z+1)=w(y-z))(z+1)$$
$$xy(y-z-1)=w(y-z))(z+1)$$
$$x=\left \lceil\frac{w(y-z)(z+1)}{y^2-zy-y}\right\rceil$$
Since we need x to be an integer, we simply round up
EDIT: If you don't want to round up, simply find $a$ when
$$w(y-z)(z+1)+a\text{ mod } {y^2-zy-y} \equiv 0$$ and the solution becomes $$x=\frac{w(y-z)(z+1)+a}{y^2-zy-y}$$