I am trying to solve the following equation:
n*const1 + const2 = x^2
Where n, const1, const2 and x are integers > 0. Const1, const2 are known, n and x are variables.
The naive solution to this problem is to iterate all n's and check if the square root of the result is integer. This solution is however too slow:
for n = 0;; n++: if sqrt(n*const1 + const2) is integer: end. else: continue.
Would it help, if the const1 was a prime number?