I have been working on the following problem:
For a given $c\in \Bbb Z^+$, find $a,b \in \Bbb Z^+: c=a^2-b^2$.
I have already figured out and proved a number of things:
- A way to directly determine if a particular instance is solvable: $\exists a,b \in \Bbb Z^+: c=a^2-b^2 \iff c \not\equiv 2 \mod 4$
- An upper bound on the values for a (and b): $b \lt a\le\lfloor\frac{c-1}{2}\rfloor$
And a simple algorithm to find a solution:
$$ \begin{align*} (a_0, b_0) &= (0, 0) \\ (a_{n+1}, b_{n+1}) &= \begin{cases} (a_n+1, &b_n&)&\text{if } a_n^2-b_n^2 < c\\ (a_n, &b_n+1&)&\text{if } a_n^2-b_n^2 > c\\ \end{cases} \end{align*} $$
This can be iterated until a solution is found or the upper bound is reached.
I am currently trying to work out a more direct way to find an answer, but I have been unable to figure out any other ways to approach the problem.
How can I more directly find values for $a$ and $b$ for a given value of $c$?