Let's say I have a function: $f(x) = \sqrt{x^2+8a}$,
Constraints: $a,x \in \mathbb{N}$, $a$ mod 2 = 1.
What would be the most efficient algorithm to find every natural $x$, so that $f(x) \in \mathbb{N}$?
$a$ is arbitrarily large, thus evaluating $f(x)$ for all $x$ is too computationally expensive. Is it possible to formulate a case specific test, to check that $x^2 + 8a$ is a perfect square?
Set $y=f(x)$
You have $y^2=x^2+8a$ whence $y^2-x^2=(y+x)(y-x)=8a$
Now $y+x$ and $y-x$ differ by $2x$ hence have the same parity, and at least one of them is even ...
I will leave you to work out the consequences of this.