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  considered this problem in 1913. He found five solutions and conjectured that there were no more. Then in 1959 three authors  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  published a solution in 1960 after becoming aware of . 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
This leads, via the quadratic equation, to the equation at the top of the post.
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.
 K. J. Sanjana and T. P. Trivedi, J. Indian Math. Soc. vol. 5 (1913) pp. 227-228.
 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
 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.