So I had a more complicated problem and managed to reduce it to something of the the form: $c|({ax+b})$ where $x$ is an integer. I need to express $x$ as a function of some parameter $k$.
$a, b$ and $c$ are constants. I have to find all integer solutions for $x$ and express them as some function with one parameter. So I should get a function $x(k)$.