There are nonzero natural numbers ($\geq 1$) $a,b,c,d$.
$c$ is fixed, and prime factorization of $c$ is available. The prime factorization of $c$ always have the same nonzero exponent - that is $2^z3^z5^z...$ where $z$ is the exponent. And
$ab=cd=e$
We define another nonzero natural number $k = \frac{c}{p^z}$ where $p$ is some prime factor of $c$.
The question is, what would be a way to minimize $|a-b|$ while $a+b$ is multiples of $k$? I wish to find the method for every possible number of prime factors in $c$.
(If $z=1$ and $c$'s prime factors being all prime numbers from 2 to some number makes cases much easier, that's also fine.)
Difference is nonzero, and $a,b,d$ can be set freely as long as they satisfy constraints.