Sirix asks about how to list all (integer) solutions to the Ramanujan equation, *x*^2 + 7 = 2^*n*. He has the basic method right: factor the left-hand side in **Q**(SQRT(-7)), whose ring of integers, **Z**[0.5+0.5SQRT(-7)], has class number 1.

Now, let’s denote SQRT(-7) by *s* to make things easier. We get (*x* + *s*)(*x* – *s*) = 2^*n*. If *x* is even, *x*^2 + 7 is not divisible by 2, and there are no solutions; hence, suppose that *x* is odd. Then *x* (+/-) *s* is divisible by 2, yielding ((*x* + *s*)/2)((*x* – *s*)/2) = 2^*m*, where *m* = *n* – 2.

In **Q**(SQRT(-7)), 2 splits completely as ((1 + *s*)/2)((1 – *s*)/2), and (*x* (+/-) *s*)/2 isn’t divisible by 2. So (*x* (+/-) *s*)/2 is a power of (1 + *s*)/2 – in fact, an *m*th power. Since the ring has integral basis {1, (1 + *s*)/2}, we can let *r* = (1 + *s*)/2, whose conjugate *r*‘ is (1 – *s*)/2 = 1 – *r*.

Sirix goes on to define a sequence *b*(*m*) based on the *r*-coefficient of *r*^*m*. Since *r*^2 = (-2 + *r*), we get that if *r*^*m* = *a* + *br*, then *r*^(*m* + 1) = -2*b* + (*a* +* b*)*r*. It easily follows that *b*(*m*) = *b*(*m* – 1) – 2*b*(*m* – 2), with *b*1 = *b*2 = 1. Finding the set of all *m*‘s for which *b*(*m*) = (+/-)1 is then equivalent to solving the Ramanujan equation.

A possible way of showing that the only *m*‘s for which *b*(*m*) = (+/-)1 are 1, 2, 3, 5, and 13 is proven in this paper. But I’ll follow a more direct proof, which does not depend on the sequence *b*(*m*), though of course it proves the fact about the sequence indirectly.

First, suppose *n* = 2*k*. Then 2^*n* – *x*^2 splits in **Z** as (2^*k* + *x*)(2^*k* – *x*) = 7. Assuming *x* is positive, it means 2^*k* + *x* = 7 and 2^*k* – *x* = 1, so that *k* = 2, *n* = 4, and *x* = 3. Now, suppose *n* > 4, which means *n* is odd and *m* > 2.

Then (*x* (+/-) *s*)/2 = ((1 (+/-) *s*)/2)^*m* implies (+/-)*s* = *r*^*m* – *r*‘^*m*. Now *s* = *r* – *r*‘, so if *s* = *r*^*m* – *r*‘^*m*, then *r* – *r*‘ = *r*^*m* – *r*‘^*m*. But *r*‘ = 1 – *r*, so *r*^2 = (1 – *r*‘)^2 = 1 – 2*r*‘ + *r*‘^2 = 1 mod *r*‘^2 since *r*‘ divides 2. Since *m* is odd, this means that *r*^*m* = *r* mod *r*‘^2, so *r* – *r*‘ = *r*^*m* – *r*‘^*m* = *r* mod *r*‘^2, which implies *r*‘ = 0 mod *r*‘^2, a contradiction.

We therefore get –*s* = *r*^*m* – *r*‘^*m*; multiplying both sides by 2^*m* and using a binomial expansion, we get –*s**2^*m* = (1 + *s*)^*m* – (1 – *s*)^*m* = 2*s*(*m* – 7*C(*m*, 3) + 49*C(*m*, 5) – … + 7^((*m* – 1)/2)), where C(*n*, *k*) is *n* over *k*, the number of ways to choose *k* elements out of *n*.

After dividing by 2*s*, we get -2^(*m* – 1) = *m* mod 7. The sequence of residue classes of 2^(*m* – 1) mod 7, beginning with *m* = 1, is (1, 2, 4). So solutions to the equation are determined by the residue class of *m* mod 21; the only possible solutions are then *m* = 3, 5, or 13 mod 21.

Since 3, 5, and 13 solve the Ramanujan equation, it suffices to show that if *m* and *m*‘ are solutions that have the same residue class mod 21, then *m* = *m*‘. To do that, let 7^*k* divide *m* – *m*‘, with *k* > 0. It suffices to show that 7^(*k* + 1) divides *m* – *m*‘ as well, since then *m* – *m*‘ is infinitely divisible by 7, making it 0.

The group of nonzero residue classes mod 7^(*k* + 1) has 6*7^*k* elements, so 2^(6*7^*k*) = 1 mod 7^(*k* + 1). In fact 2^(3*7^*k*) = 1 mod 7^(*k* + 1), because 2 is a quadratic residue of 7, hence of every power of 7. Since 3*7^*k* = lcm(21, 7^*k*) divides *m* – *m*‘, it means 2^(*m* – *m*‘) = 1 mod 7^(*k* + 1).

Also, (1 + *s*)^(*m* – *m*‘) = 1 + (*m* – *m*‘)*s* – 7*C(*m* – *m*‘, 2) – … (+/-) *s*^(*m* – *m*‘). All terms except the first two are divisible by 7^(*k* + 1); this is obvious for all terms except the last, for which it holds since 7^(*k* + 1) divides *s*^(2*k* + 2), and 2*k* + 2 < 7^*k* < *m* – *m*‘ for all *k* > 0. So (1 + *s*)^(*m* – *m*‘) = 1 + (*m* – *m*‘)*s* mod 7^(*k* + 1), and *r*^(*m* – *m*‘) = 1 + (*m* – *m*‘)*s* mod 7^(*k* + 1).

Finally, (1 + *s*)^*m* = 1 mod *s*, and 2*4 = 1 mod *s*, so that *r*^*m* = 4^*m* mod *s*. Now *r*^*m* – *r*^*m*‘ = *r*^*m*‘(*r*^(*m* – *m*‘) – 1) = (*r*^*m*‘)(*m* – *m*‘)*s* mod 7^(*k* + 1) = (4^*m*)(*m* – *m*‘)*s* mod 7^(*k* + 1). The last equality is the trickiest. It requires noting that (*m* – *m*‘)*s* is divisible by *s**7^*k*, so that the residue class of *r*^*m* – *r*^*m*‘ mod 7^(*k* + 1) depends only on this of *r*^*m*‘ mod *s*.

Taking conjugates, we get that *r*‘^*m* – *r*‘^*m*‘ = -(4^*m*)(*m* – *m*‘)*s* mod 7^(*k* + 1); note that *m*‘ is not the conjugate of *m*, despite the notation. We get by subtracting *r*^*m* – *r*^*m*‘ – *r*‘^*m* + *r*‘^*m*‘ = 2(4^*m*)(*m* – *m*‘)*s* mod 7^(*k* + 1). But *r*^*m* – *r*‘^*m* = *r*^*m*‘ – *r*‘^*m*‘ = –*s*, since we assume *m* > 2. So 2(4^*m*)(*m* – *m*‘)*s* = 0 mod 7^(*k* + 1). As 2 and 4 are not divisible by 7, this reduces to (*m* – *m*‘)*s* = 0 mod 7^(*k* + 1).

Finally, note that *m* and *m*‘ are in **Z**. The congruence mod 7^(*k* + 1) implies that *m* – *m*‘ is divisible by *s**7^*k*, i.e. that (*m* – *m*‘)/7^*k* is divisible by *s*. But the only integers that are divisible by *s* are divisible by 7, since the ideal (*s*) intersects **Z** in (7). Therefore *m* – *m*‘ is divisible by 7^(*k* + 1), which is enough to prove that the only solutions to the Ramanujan equation are those with *m* = 1, 2, 3, 5, or 13.

It seems ok, though I still hope there exist a solution that is more from_the_Book :-).

“But I’ll follow a more direct proof, which does not depend on the sequence b(m), though of course it proves the fact about the sequence indirectly.”

“We therefore get -s = r^m – r‘^m;”

Small remark: In fact, you are quite directly proving that b_m is not -1: closed form for b_m is exactly b_m = 1/s * (r^m – r’^m).

Is it your solution? If not, can you give a reference?

It’s not mine; the proof is from Stewart and Tall’s book

Algebraic Number Theory. I tried proving it by using the fact thatb(n) is a Fibonacci-type sequence, but when I tried constructing a closed form equation for it, all I got was Im((1 +s)^n)/s.