Calculate the minimum value of an integer $x$, such that $\left\lfloor\frac{xy^2}{xy+w(y-z)}\right\rfloor>z$

39 Views Asked by At

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?

2

There are 2 best solutions below

1
On BEST ANSWER

$$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}$$

1
On

Not sure why, but it seems that the correct solution is $x=\frac{w(yz-z^2+y-z)\color\red{-1}}{y^2-yz-y}+1$.