**Post 4/29 in the Staffrm #29daysofwriting challenge: Fermat's Christmas theorem**

The question concerned the sums of pairs of consecutive square numbers - 1² + 2², 2² + 3² … up to 5² + 6², and how many of these answers were prime.

The first thing that got me wondering was what happened if I carried on – so far, all the numbers in the sequence had either been prime or square. Unfortunately, this came to a dead end really quickly, as the next one, 6² + 7² gave me 36 + 49 = 85, which is definitely neither prime nor square.

A quick search on Google got me to Fermat’s theorem on sums of two squares, sometimes called Fermat’s Christmas theorem because he first announced it in a letter to Mersenne dated December 25th – clearly Christmas in 1640 wasn’t up to much. The theorem states that a prime can be written as the sum of two squares if and only if p is congruent to 1 mod 4.

(If you’re not familiar with modular arithmetic, the best way to think about it is like a traditional clock – it only counts up to 12, so when we get to the 13th hour, this shows as 1 on the clockface, or in other words, 13 is congruent to 1 mod 12).

So if we're working in mod 4, we'd count up to 4 then "reset" back to 1 again. The numbers congruent to 1 are therefore 5, 9, 13, 17, 21, 25 ... - the sequence 4n + 1.

From the theorem, each prime in this list is expressible as a sum of two squares - so 17 is 1² + 4², and 29 is 2² + 5². Getting pupils to explore these ideas would offer plenty of opportunities to practice work on primes and squares.

I noticed something else quite curious when looking at the overlap between the sequence 4n + 1 and the "sequence" of questions given in the UKMT paper. From what I could tell up to 61, the "gaps" between the numbers in both sequences seemed to be getting larger by 1 each time.

Furthermore, the sequence 4n + 1 hits every other square number - so hits 9, misses 16, hits 25, misses 36 - nicely demonstrating that every odd square number can be written in the form 4n + 1 and every even in the form 4n. Another nice quick exercise might be to find the nth term of the original sequence of questions.

I've written a quick activity based around this to start Year 10's lesson off tomorrow - if you're interested, you can get it here.