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?

  • $\begingroup$ yup. x is clearly an integer because it is a perfect square... $\endgroup$
    – Simo Ryu
    Commented May 24, 2018 at 14:52
  • $\begingroup$ 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. $\endgroup$
    – enedil
    Commented May 24, 2018 at 18:07
  • $\begingroup$ $$A^2+x^2=z^2$$ $$B^2-x^2=y^2$$ a task like this?????? $\endgroup$
    – individ
    Commented May 24, 2018 at 18:21
  • $\begingroup$ Oh my, I meant squares!!! This was an extreme typo that I shouldn't have made!!! I'm so sorry for this. $\endgroup$
    – Simo Ryu
    Commented May 24, 2018 at 23:20
  • $\begingroup$ Yes, such problem was what I originally wanted to ask, but I still would like to know when A is not a perfect square. $\endgroup$
    – Simo Ryu
    Commented May 24, 2018 at 23:22

2 Answers 2


This system of equations:


Solutions have the form:






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

  • $\begingroup$ A and B don't need to be perfect squares $\endgroup$
    – enedil
    Commented May 24, 2018 at 18:40
  • $\begingroup$ It says "Given integers $A, B$, say something about all such $x$ s.t. $A-x$, $B+x$, $x$ are perfect squares. $\endgroup$
    – enedil
    Commented May 24, 2018 at 18:41
  • $\begingroup$ 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? $\endgroup$
    – Simo Ryu
    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$).


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .