Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

How one expect the possible values of $(x, y, z) = (0, 0,0), (1, 1, 1)$ and $(3, 1, 5)$ of the equation $3^x -2^y = z^2$ without by inspection.

Why $n = 1$ and $3$ are valid for $5^n - 4 = z^2$.

Is there any other $n$, other than these $1$ and $3$? without inspection how we prove the solutions/how we will find other solutions if there?


share|improve this question
Google search "Ramanujan-Nagell equation" and you should find your answer –  Kirthi Raman Mar 21 '12 at 12:54
@prema: For $5^n-4=z^2$, I think I posted a solution on this site less than a month ago. –  André Nicolas Mar 21 '12 at 14:35
@Andre Was that "Solve $x^2+4=y^d$ for $d \geq 3$ question. It is tinyurl.com/7mchmtt (this one) –  Kirthi Raman Mar 21 '12 at 14:53
@KV Raman: My memory was not quite accurate. The question about $5^n$ is different, easier but different. –  André Nicolas Mar 21 '12 at 15:35
@Prema Is there a specific goal you have? Are you doing research? I would suggest you read a paper written by J.H.E.Cohn at tinyurl.com/7dgok6k. I changed the title so that more people could pay attention. I wish I knew the answer. –  Kirthi Raman Mar 22 '12 at 12:33
show 4 more comments

1 Answer

I've had a look at the first one and have managed to make a decent amount of headway. I suspect that to get any further (or to do the second question) one would have to go into the Gaussian integers, which I'm not used to working with, so I'll just give you what I have at the moment.

We are given:


I'll start by considering the case when one or other of $x$ and $y$ is $0$. If $x=0$, then $z^2+2^y=1$, and it is clear that the only solution is $x=y=z=0$, or $(0,0,0)$. If $y=0$, then $3^x-1=z^2$. Since no square number is one less than a multiple of $3$ (by simple arithmetic $\mod 3$), $3^x=1$ and again the only solution is $x=y=z=0$. So from now on we may assume that $x$ and $y$ are strictly positive. This means that $3^x-2^y \neq 0$ (as $3^x$ is odd and $2^y$ is even), so $z>0$. It also means that $z$ is neither a multiple of $2$ nor a multiple of $3$.

First suppose that $x$ is even, and write $x=2k$. So $3^{2k}-2^y=z^2$. Rearranging this, we get $2^y=(3k)^2-z^2$, which we can factorize to give $2^y=(3k+z)(3k-z)$. This means that $(3k+z)$ and $(3k-z)$ are both powers of $2$ - write:

$3k+z=2^a\; \;$ (1)

$3k-z=2^b\; \;$ (2)

Now, subtracting (2) from (1) gives $2z=2^a-2^b$. Since $z>0$, $2^a>2^b$. Adding (1) and (2) gives $2 \times 3^k = 2^a+2^b$. So $3^k=2^{a-1}+2^{b-1}$. Since $3^k$ is odd, $2^{b-1}=1$. So, setting $c=a-1$, we see that $3^k=2^c+1$ and that $z=2^c-1$. So all solutions where $x$ is even are of the form $3^{2k}-2^{c+2}=(2^c-1)^2$, where $3^{2k}=(2^c+1)^2$. The only powers of $3$ which are one more than a power of $2$ are $3^1=2^1+1$ and $3^2=2^3+1$ (see below), which yield the solutions $(2,3,1)$ and $(4,5,7)$.

Now suppose instead that $x$ is odd, and write $x=2k+1$. So $3^{2k+1}-2^y=z^2$. We can rewrite this as $3 \times 3^{2k}-2^y=z^2$, and then rearrange this to $3^{2k}-z^2=2^y-2 \times 3^{2k}$. We can factorize this as $(3^k-z)(3^k+z)=2(2^{y-1}-3^{2k})$. Since the two factors on the left differ by $2z$, which is even, they are either both even or both odd. But since the right hand side is even, at least one of them must be even. So they must both be even. This means that $2(2^{y-1}-3^{2k})$ is a multiple of $4$, so $(2^{y-1}-3^{2k})$ is even. Since $3^{2k}$ is odd for any $k$, $2^{y-1}$ must be odd. So $2^{y-1}=1$, and therefore $y-1=0$, so $y=1$.

This reduces the '$x$ is odd' case to the simpler case $3^x-2=z^2$, which looks as if it's going to require Gaussian integers to solve. Two solutions, which you give, are $(1,1,1)$ and $(3,1,5)$.

In summary:

$0$. $x=y=z=0$ is the solution if either $x$ or $y$ is $0$. If $x \neq 0 \neq y$ then there are two cases to consider:

$1$. If $x$ is even, then all solutions are given by the identity $(2^a+1)^2−4×2^a=(2^a−1)^2$, where $(2^a+1)$ is a power of $3$.

$2$. If $x$ is odd, then $y=1$, and the problem becomes similar to question $2$.

A quick proof that the only powers of $3$ which are one more than a power of $2$ are $3^1$ and $3^2$ - write $3^x=2^y+1$. Now if $y$ is even, then $2^y$ is a square, so $3^x$ cannot be a multiple of $3$ (by arithmetic $\mod 3$), so $3^x=1$. But that means that $2^y=0$, which is a contradiction. So $y$ is odd.

Now suppose $x$ is even. Then we can write $3^{2k}-1=2^y$ and factorize the LHS to give $(3^k+1)(3^k-1)=2^y$. So $(3^k+1)$ and $(3^k-1)$ are two powers of $2$ differing by $2$; the only such pair is $2$ and $4$, so $3^k=3$. So $3^x=9$, giving $2^y=8$.

Suppose instead that $x$ is odd. Let $x=2k+1$ and $y=2r+1$, as $y$ is odd. Now we can see that $3^{2k+1}-1=2^{2r+1}$. We can write this as $3 \times 3^{2k}-1=2 \times 2^{2r}$ and rearrange this to give $3^{2k}-1=2(2^{2r}-3^{2k})$, which we can factorize as $(3^k-1)(3^k+1)=2(2^r-3^k)(2^r+3^k)$. Now $(3^k-1)$ and $(3^k+1)$ differ by $2$, so they are both even or both odd. Because of the factor of $2$ on the RHS, they are both even (and $3^k$ is odd), so the RHS must be a multiple of $4$. So at least one of $(2^r-3^k)$ and $(2^r+3^k)$ is even, which means that $2^r$ must be odd. So $2^r=1$, which means that $2^y=2$, giving $3^x=3$.

share|improve this answer
Just a small note: If $y=0$, then $3^x -1=z^2$, and not $z^2+3^x=1$ –  Kirthi Raman Mar 26 '12 at 18:48
Thanks for spotting that - I've now corrected the error. –  Donkey_2009 Mar 29 '12 at 14:32
I had to wait to see if there are more answers. (Kudos on the bounty!) –  Kirthi Raman Mar 30 '12 at 12:12
Thanks - I'm afraid I didn't really fulfil the requirements, but I haven't given up yet on finishing the problem off! –  Donkey_2009 Mar 30 '12 at 12:19
You could always come back and update I think :) –  Kirthi Raman Mar 30 '12 at 14:58
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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