This post was inspired by a question of Trevor Wooley after a talk of James Maynard at MSRI. He asked what was known for lower bounds of large gaps between integers that have a representation as the sum of two squares. We assume some familiarity with the large gaps between primes problem.

A theorem of Fermat asserts that an integer, is represented by the sum of two squares if and only if all the prime factors of equivalent to 3 modulo 4 appear with an even power.

For technical simplicity, we consider the set of integers that simply have no prime factors equivalent to 3 modulo 4, but one may extend the considerations below to the original question.

The size of such a set is proportional to . Thus the average gap is and so the average gap is at least this big.

Surprisingly, there is an easy argument that yields a gap of size . We sketch it here. For each prime equivalent to 3 modulo 4, choose a residue class . Using a greedy algorithm to choose the , we may sieve out the integers in for . By the Chinese remainder theorem, there is a such that for all the relevant . Thus all contain a prime factor equivalent to 3 modulo 4, as desired.

What should one expect? Adopting the Cramer model, we expect that there should be gaps of size at least . We give a rough sketch as to why one should expect this. Let . We suppose that an integer is chosen random with probability . Then the probability that is which is well approximated by . If , then this is around the number of choices for . One can see the Cramer model worked out more carefully here.

Fix and coprime to . Now we consider the set . The Cramer model, as above, suggests that there should be gaps between elements of that are of size . Nevertheless we may utilize the trivial bound above to obtain gaps of size . Thus, for these , we can come arbitrarily close (i.e. an arbitrarily small power of log) to the lower bounds associated to Cramer’s conjecture.

Note for primes, we are nowhere near Cramer’s conjecture. Ford, Green, Konyagin, Maynard, and Tao have the best lower bound. Things look worse for upper bounds, as no one knows how to improve upon a power of for the primes or any of the sets mentioned in this post (even if one assumes the Riemann hypothesis).