Find the positive integers $(2^x-1)(3^y-1)=2z^2$ have three solutions $$(1,1,1),(1,2,2),(1,5,11)$$I already know $(2^x-1)(3^y-1)=z^2$ has no solution. See: P.G.Walsh December 2006 [On Diophantine equations of the form] paper but there is a factor of $2$ that seems complicated, and I didn't know anyone had studied this before. If so, please help me with the article or link, thanks.

  • 1
    $\begingroup$ Can you show that x has to be one? Gerhard "Try It. It's Not Hard" Paseman, 2018.03.31. $\endgroup$ Apr 1, 2018 at 5:33
  • 2
    $\begingroup$ And after you show that $x=1$, as Gerhard suggests, you can take the three cases $y=3w$, $y=3w+1$, and $y=3w+2$, which reduces the problem to finding the integer points on three fairly standard elliptic curves. $\endgroup$ Apr 1, 2018 at 12:26
  • 2
    $\begingroup$ Actually, the argument in the linked-to reference goes through essentially line by line, with nary an elliptic curve. $\endgroup$
    – Igor Rivin
    Apr 1, 2018 at 18:14
  • 13
    $\begingroup$ The Diophantine equation $2z^2+1 = 3^y$ that appears for $x=1$ has already been studied: $2z^2+1 = 4{z \choose 2} + 2z + 1$ is the volume of a radius-2 ball in ternary Hamming space ${\bf F}_3^z$, so $2z^2+1 = 3^y$ is a necessary condition for the existence of a perfect 2-error-correcting ternary code in that space. It is known that $z=1,2,11$ are the only solutions, each corresponding to a code (trivial codes for $z=1$ and $2$, and the ternary Golay code for $z=11$). $\endgroup$ Apr 11, 2018 at 2:49
  • 2
    $\begingroup$ Following the hint of @NoamD.Elkies , I found a 1958 paper of CY Lee "Some properties of nonbinary error-correcting codes" ieeexplore.ieee.org/document/1057446 which attributes the solution of $2z^2+1=3^y$ to T. Nagell. Since it is hard to find, I have uploaded a copy of Nagell's 1923 paper "Sur l'impossibilité de quelques equations à deux indéterminées" here dropbox.com/s/69iuu00ux30dclu/nagell1923.pdf?dl=0 (this dropbox link is not really permanent, so rehosting would be appreciated). Perhaps someone more expert than me could write an answer? $\endgroup$
    – j.c.
    Apr 16, 2018 at 19:49

1 Answer 1


I don't have a solution but since we're facing a narrow margins situation I'll answer. I followed the approach I guessed Gerhard Paseman's comment was talking about but there was an unforeseen complication.

If $\gcd(2^x-1,3^y-1)=1$ we have



for integers $p,q$. We can factor the first one in $\mathbb{Z}[i]$


the two factors on the right hand side have the same modulus so they both must be a unit times $1+i$





we have unique factorization so the power of $1+i$ on the right hand side has to match the one on the LHS so $x\leq 2$. $x=2$ doesn't work mod 3 so we have $x=1$.

Now splitting into three cases for each residue of $y\mod 3$:

  • $y=3w$



and to transform into an elliptic curve $w=w_1/2$ and $z=z_1/4$


This is a Mordell curve so we can just look up the results. Bennet and Ghadermarzi have a table with all these solutions and looking up this and the other two cases, which turn out to have coefficients $-72$ and $-648$, we find that the three are the only solutions.

Now if $\gcd(2^x-1,3^y-1)\neq1$. I couldn't solve this case, but when $\gcd(x,y)=1$ I found some really weird behavior which made me think solving it in general might be harder than expected because it involves a relationship between $\text{ord}_p(2)$ and $\text{ord}_p(3)$. If a prime $p$ divides both sides of the gcd we have

$$2^x\equiv 3^y\equiv 1\mod p$$

$$\gcd(\text{ord}_p(2),\text{ord}_p(3)) = 1$$

This is relatively fast to calculate on a computer so I was able to find that $p=683,599479$ are the only possibilities under $10^9$. This is now OEIS sequence A344202, where you'll find 6 more terms which means mathematica has a faster way of calculating these than I do.

I feel like the $\gcd(x,y)\neq 1$ case might simplify to the previous one, but ruling out the few primes that satisfy the condition about the multiplicative orders of two and three will be difficult. For both of the primes I found we have $\text{ord}_p(2)\text{ord}_p(3)=p-1$ and there exists an unique element $r$ in $\mathbb{Z}_p$ so that $r^{\text{ord}_p(2)}\equiv 3$ and $r^{\text{ord}_p(3)}\equiv 2$. For $p=683$ it was $r\equiv 218$ and for $p=599479$, $r\equiv 45077$.

  • 7
    $\begingroup$ $2^x-1=p^2$ fails modulo $4$ for $x\ge2$. $\endgroup$ May 9, 2021 at 0:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.