Solve $a^2=b+c^2$ with integers

49 Views Asked by At

I am wondering if there is an efficient way to solve $a^2=b+c^2$ for $a$ and $c$ when $b$ is given, and all three variables are integers greater than $0$. I know that because there are two variables, there may be infinite solutions. I would prefer to get the lowest possible positive integer values of $a$ and $c$ that make the equation true. I can solve this with trial and error, but there must be a faster way.

1

There are 1 best solutions below

2
On

When $b$ is given, you have $a^2=b+c^2$, which you can rearrange to find $(a+c)(a-c)=b$, so you need to look for the factors of $b$ where the two numbers in the product differ by an even number (the even number is $2c$).