I'm trying to make an efficient algorithm to find one of the solutions and how many solutions there are to the equation $$Ax+By+Cz=D$$ where $A,B,C,D\in \mathbb Z$ and the range for $x,y,z\in \mathbb Z$ are given by the user.
I saw this: https://math.stackexchange.com/a/20944/146115 answer but when I tried to apply it, it was wrong.
For example: $2x-3y-z=5$ in range $[-2,2]$ I know that it has 6 solutions but when I use the method in the above solution (2) I get: $\gcd (2,3)=1 \to w-z=5$ but this equation has no solutions in $[-2,2]$.
Is there another method to make this problem easier to solve, i.e, is there an efficient algorithm that will run on less than $O(n^3)$ runtime?