Three paths converge

When does the equation

x2 + 7 = 2n

have integer solutions?

This is an interesting question, but why would anyone ask it? This post looks at three paths that have led to this problem.


Ramanujan [1] considered this problem in 1913. He found five solutions and conjectured that there were no more. Then in 1959 three authors [2] wrote a paper settling the conjecture, showing that Ramanujan was right. We don’t know what motivated Ramanujan, but the subsequent paper was a response to Ramanujan.


T. Nagell [3] published a solution in 1960 after becoming aware of [2]. This paper republished in English a solution the author had first published in 1948 in a Norwegian journal. Nagell says he gave the problem as an exercise in a number theory textbook he wrote in 1951. By mentioning his textbook but not Ramanujan, Nagell implies that he came to the problem independently.


I ran into the problem a week ago in the course of looking at a problem that came out of Golay’s work in coding theory. A necessary condition for the existence of a perfect binary code of length n including p redundant bits that can detect up to 2 errors is

{n \choose 0} + {n \choose 1} + {n \choose 2} = 2^p

This leads, via the quadratic equation, to the equation at the top of the post.

All solutions

Each of the paths above states the problem in different notation; it’s simpler to state the solutions without variables.

  • 12 + 7 = 23
  • 32 + 7 = 24
  • 52 + 7 = 25
  • 112 + 7 = 27
  • 1812 + 7 = 215

Verifying that these are solutions is trivial. Proving that there are no more solutions is not trivial.


[1] K. J. Sanjana and T. P. Trivedi, J. Indian Math. Soc. vol. 5 (1913) pp. 227-228.

[2] Th. Skolem, S. Chowla and D. J. Lewis. The Diophantine Equation 2n+2 – 7 = x2. Proceedings of the American Mathematical Society , Oct., 1959, Vol. 10, No. 5. pp. 663-669

[3] T. Nagell, The Diophantine Equation x2 + 7 = 2n. Arkiv för Matematik, Band 4 nr 13. Jan 1960.

Thanks to Brian Hopkins for his help on this problem via his answer to my question on Math Overflow.

2 thoughts on “Three paths converge

  1. Most of the time the posts here streak past me like hypersonic craft in the stratosphere, while I’m waiting below for a snail to go past me on the ground allowing me time to focus on it.

    This post made me wonder about the properties primes lose with size, where I view problems having prime solutions as reflecting on the properties of primes as a whole, and how it seems that larger primes have fewer such properties.

    Is this true? Are large primes actually “simpler” in this respect? Or are there “general-ish” properties that primes obtain only with increasing size? That is, characteristics that do not apply to smaller primes.

Comments are closed.