$ks^2 = hw : k, s, h, w \in \mathbb{Z}^+ $
Suppose I want to maximize $k$ and minimize $s$ for a given $h, w$. In that case, the solution is trivial: $s=1, k=hw$, But, I want to find $k, s$ given a value of $h, w$ such that $k$ has the least possible value and $s$ has the highest possible value satisfying the above equation. How can I approach this? In many cases, solutions other than s=1 may not exist, for example, h=5, w=7. How can I mathematically validate whether other solutions exist or not?
Lets take an practical example: Lets say, I want to represent a rectangle of size $(h,w)$ as a grid of the largest possible square with side s. Where no. of squares in the grid is $k$. Now, I want to the what would the largest possible value of $s$ with $k$ also being a positive integer.