find whether difference of square of two number is equal to cube of a given number

43 Views Asked by At

We are given a number b. We have to find is there any pair of integers exist which satisfy $a^2+b^3=c^2$. Suppose b=3 then pair 3,6 exist. Is there any algorithm to check this existence?

1

There are 1 best solutions below

2
On BEST ANSWER

Every number not twice an odd number is a difference of two squares. No cube is twice an odd number, so every cube is a difference of two squares.

Given $n$, not twice an odd number, there is an easy way to find all ways to express $n$ as a difference of two squares (provided that you can factor $n$). I won't give the details, since surely this has been done already many times on this website. But for cubes it's particularly easy, since we have the factorization. $b^3=c^2-a^2$, where $c=(b^2+b)/2$ and $a=(b^2-b)/2$.