# A-x, B+x, x is all perfect square (Diophantine equation)

How many solutions are there to following diophantine equations? (or, asymptotically?)

For positive integers $A, B$, $A-x, B+x, x$ is all perfect square.

First of all, the number of solutions $(m,n)$ that $A=m^2+n^2$ is $r'_2(A)$, that one can look up for explicit formula in here. http://mathworld.wolfram.com/SumofSquaresFunction.html

Therefore above the number of solution above must be less or equal to $r'_2(A)$. Now, a heuristic argument comes in. One can suppose that chance of $B+x$ being a perfect square is about $O(\frac{1}{\sqrt(B)})$, therefore vaguely one can argue that above solution has upper bound of $O(\frac{r'_2(A)}{\sqrt(B)})$. But notice that this argument has so many flaws on so many levels. Would anyone like to consider this problem? Or is this problem already quite famously solved?

• yup. x is clearly an integer because it is a perfect square... Commented May 24, 2018 at 14:52
• All your conclusions are false, since the question asks about perfect powers and not squares specifically. Decide whether the title or the problem statement is wrong. Commented May 24, 2018 at 18:07
• $$A^2+x^2=z^2$$ $$B^2-x^2=y^2$$ a task like this?????? Commented May 24, 2018 at 18:21
• Oh my, I meant squares!!! This was an extreme typo that I shouldn't have made!!! I'm so sorry for this. Commented May 24, 2018 at 23:20
• Yes, such problem was what I originally wanted to ask, but I still would like to know when A is not a perfect square. Commented May 24, 2018 at 23:22

This system of equations:

\left\{\begin{aligned}&A^2+x^2=c^2\\&B^2-x^2=z^2\end{aligned}\right.

Solutions have the form:

$$x=4tkp^2s^2$$

$$A=2(t^2-k^2)p^2s^2$$

$$z=4k^2s^4-t^2p^4$$

$$c=2(t^2+k^2)p^2s^2$$

$$B=4k^2s^4+t^2p^4$$

$t,k,p,s$ - integers asked us.

• A and B don't need to be perfect squares Commented May 24, 2018 at 18:40
• It says "Given integers $A, B$, say something about all such $x$ s.t. $A-x$, $B+x$, $x$ are perfect squares. Commented May 24, 2018 at 18:41
• This helped so very much, but is this the only solution? And how does one come up with this solution? Clearly It can be a solution but possibly not unique form? Commented May 24, 2018 at 23:23

Suppose that you indeed mean

For positive integers $A,B$, $A−x,B+x,x$ is all perfect square

One trivial bound for number of solutions is $A$. Indeed, if $A < x$, then $A - x < 0$ and thus cannot be a perfect square.

Now, suppose that $x = k^2$, $A-x = m^2$, $B+x = k^2$. It follows that $B = n^2 - k^2 = (n+k)\cdot (n-k)$. Suppose that $B = r \cdot s$. It follows that $n = \frac{r+s}2$, $k = \frac{r-s}2$. That defines bijection between paris $(n, k)$ and $(r, s)$ and thus the number of solutions is at most half of the number of factors of $B$ (since we consider ordered pairs only, as $n > k$).