When does the equation

*x*^{2} + 7 = 2^{n}

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

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.

## Nagell

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.

## Golay

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.

## All solutions

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

- 1
^{2}+ 7 = 2^{3} - 3
^{2}+ 7 = 2^{4} - 5
^{2}+ 7 = 2^{5} - 11
^{2}+ 7 = 2^{7} - 181
^{2}+ 7 = 2^{15}

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

## References

[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 2^{n+2} – 7 = *x*^{2}. Proceedings of the American Mathematical Society , Oct., 1959, Vol. 10, No. 5. pp. 663-669

[3] T. Nagell, The Diophantine Equation *x*^{2} + 7 = 2^{n}. 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.

Here’s a relevant OEIS entry: https://oeis.org/A038198

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.