IMO 2015 Diary – Part Four

Sunday 12th July

I spend many hours reading the students’ scripts for the medium questions 2 and 5. Psychologically, this solitude is quite a sudden shift after so many days of constant group interaction. Although only one of the twelve solutions is complete, I’m really pleased with how everyone has presented their progress. We’ve spoken a lot at the camps during the year about how to write up maths under various kinds of pressure so that it is intelligible to other human beings. All the boys have been very clear this year, so they should get plenty of marks and coordinating won’t cause much drama.

By comparison with the student site, the leaders’ hotel has slightly better views, slightly better food, and an even more appalling lift availability algorithm. When the work is done for the day, I meet Jill and the students at the night market, where Lawrence is sharing round a packet of fried giant crickets. They have enjoyed their excursion, especially the visit to an umbrella and other handicraft factory, where it seems they did their best to re-inflate the Thai economy. Neel has a three foot wide fan, hand-painted in a style evoking My Little Pony. While it doesn’t quite conjure the demure grace of, say, Callas as Madam Butterfly, it does induce a billowing wind tunnel effect, which is appreciated in the back of our taxi.

Monday 13th July

Today is the main day of coordination, when Geoff and I meet local markers to agree the UK students’ scores. Over breakfast we decide to ask for a solitary 1 for Joe’s hastily-written summary of Q6 in our first meeting. After some not especially thrilling wrangling about the meaning of the phrases ‘combinatorial description’ and ‘non-trivial progress’, we get what we want without having to deploy my carefully-worded speech.

This will turn out to be by some margin the most challenging meeting. On Q2, they have already decided to forgive Warren’s microscopic omission, and the mark schemes are extremely precise, especially for the middle problems which normally cause the most trouble. Everyone seems to be interpreting them sensibly and similarly so there are no delays, and we are able to bring forward the easier geometry meeting, and confirm all our marks by 5pm. We have {10,17,19,19,19,25}, which is certainly respectable, even if it does mean, to Geoff’s infinite chagrin after his boasts at breakfast, that we are beaten by France.

We’ve been keeping the students up to date via text while they’ve been petting elephants and dipping their feet in hot springs. We meet them for dinner, where they are disappointed at the lack of dramatic gossip about the process, but pleased with their scores, especially the efficient accumulation of part marks on the harder questions. It remains to be seen tomorrow what colour of medals all of this will generate.

Tuesday 14th July

While the UK is done, and I find some more obscure temples in town, other countries continue their final coordinations. It looks like Australia will have its best ever performance, with at least two students sure to receive gold medals, and the rumour is snowballing that USA has won, for the first time since the mid 90s. The students have been attending the IMO lectures this morning, and it seems that Ravi Vakil’s talk on `The Mathematics of Doodling’ has really got the UK boys thinking about space and the meaning of orientation.

Tiring of the comical lift process, I investigate the hotel’s external fire exit, disturbing a flock of pigeons, and a rat the size of a small dachshund. In pursuit of more interesting wildlife, Jill suggests we take the students to Chiang Mai Zoo for the afternoon. Sam and Harvey enjoy the real-life version of Hungry Hippos, and we find an enclosure with a large (ie at least 9), odd number of tortoises, of which precisely one is feeling rather, ahem, left out. The main attraction though is the giant panda Chaung Chaung, who we get to see eating his bamboo with the satisfied langour of a chubby toddler.

We diverge again so I can attend the final jury meeting, where after some brief admin, we pass rapidly to the medal boundaries. There is a new protocol in place this year, which I will leave for Geoff to explain, but the only non-trivial decision to be made is whether the gold cut-off should be rather higher than ideal or slightly lower than ideal. I disagree very strongly with some of the baffling comments which are made on both sides, but only the leaders have a say in this, and the end result is a narrow victory for the higher cutoff*. The UK upshot is that our triumvirate scoring 19 scrape into the silvers, while Warren unfortunately misses out on gold by one point for the third competition in a row. It’s hard to know what to say in these circumstances, but at least by meeting up with the Australian and American teams, we find other students in similar positions, and the feelings of elation and disappointment can be more widely shared.

[*As a result, about 1/15 rather than the statuted 1/12 students get the top award. The other option would have been 1/10.5. So all those leaders concerned about the ‘de-evaluation of the gold’ etc can sleep easy. So can any of their current and past gold-winning students, who had been so worried about retrospective reappraisal of their abilities. You’re right – this was ludicrous.]

Wednesday 15th July

I’ve got the rest of my life to lie in, so decide to cycle to the temple at the top of Doi Suthep. I rent the fanciest bike I can find, for B300, and, to the astonishment of everyone, a helmet for B200. Given the standard of driving, which is at times even worse than Colombia, this seems an absolute bargain. The ride itself though is more exertive than enjoyable, with no real views except the temple at the top, which is more extensive and more gold than the others in town, but also far more busy, which rather spoils the effect.

The real business of the day is the closing ceremony, held through the afternoon in the giant theatre within the student hotel. There’s an excellent drumming and dancing ensemble, and a beautifully-edited video of the IMO activities, which one probably ought to describe as comprehensive rather than a vignette. After about an hour, the medals are awarded, with a great deal more efficiency than normal. The idea to go in decreasing order of score within increasing order of medal is unusual, but does mean that our 19-ers receive their silvers together. Warren and Michael from USA compete for who can get their flag in the premier position. There are a few speeches, and a preview of IMO 2016 in Hong Kong, before we are released for more photographs and an early dinner.

The notion of having an indoor food market as part of the closing banquet is a good one, though it is a struggle to decide whether items are sweet or savoury. Lawrence, Joe and Sam get the chance to show off just how far their chopstick abilities have improved with tricky numbers like ribs and fruit salad. Then the live music starts, and whoever did the soundcheck has some questions to answer, as we can genuinely feel the bass vibrating through our chairs. We retire to the lobby which is, despite the continuing efforts of Elvis, much quieter. As various teams gather, and the students loiter to make final use of the games in the recreation room, this year’s IMO draws to a close.

Thursday 16th July

My flight to Mandalay is not until later, but I join Geoff to meet the rest of the UK group at Chiang Mai airport at 7am. Some of our students are looking rather rough round the edges, for a mixture of illness- and fatigue-related reasons, and there is enthusiasm only for a final round of anti-nausea medication. I’m sure it will be a fun 36 hours for everyone. In any case, soon they are off for a 12 hour layover in KL then home, and I have several hours to ponder.

My only negative thought about this year’s IMO was that the difficulty of the papers reduced the number of students who could feel the satisfaction of completing a medium or hard problem. Earning silver medals based on the easiest problems and part marks is not, in my opinion, entirely the idea, but of course it is the same for everyone. It’s probably also a good reflection on our training programme that the majority of our students feel they wanted to do much better, while we nonetheless came 22nd, with an entirely respectable medal haul. Certainly any disappointment felt about this result should not negate the value of everything they’ve learned by solving problems, and from discussions with each other and the staff during our training. In all other regards this IMO seemed a triumph. Students from all countries seem to have enjoyed themselves, and I’ve had a good time too.

Our camp for new students will be held in Oxford in just a few weeks’ time, and five of this team are eligible for Hong Kong next year. There’s plenty of interesting mathematics just around the corner. But right now, I’ve got to board the world’s most questionable aircraft, so consider it announced that I might have solved the Riemann hypothesis, and we’ll let fate run its course.

DSC_6104_compressed

Final Words

Training a UK team and taking them to the IMO requires a huge amount of effort from a large number of people. Thanks are particularly due to:

  • All the academic and pastoral staff at our camps this year in Oxford, Hungary, Cambridge and Tonbridge, and the UKMT office, especially Bev, who ensured everything ran smoothly. Also everyone who helped set just about enough problems to sate the voracious appetites of our students.
  • Alison, Lina, Mun, and the other staff at Nexus International School, where our stay was pleasant and conducive to good mathematics.
  • Everyone involved with IMO 2015 who ran a competition which was, from the angles I saw at least, almost faultless. In particular, our guide, Korn, who couldn’t have been more helpful. We all wish him the best as he moves to Columbia next month.
  • Paul Janssen, the inventor of Imodium, without whose contribution to science many moments of this trip would have been much less comfortable for the protagonists.
  • Geoff and Jill, who were excellent colleagues in every sense through the challenging and the joyous moments of this year’s trip.
  • Our team, comprising Joe, Lawrence, Sam, Warren, Neel and Harvey, who are all thoroughly nice people. It’s been a pleasure to watch them improve together through the past few months, and I’m sure they will go far in whatever mathematical or non-mathematical avenues they choose over the years to come.

IMO 2015 Diary – Part Three

Wednesday 8th July

Because of my complicated post-IMO itinerary, AirAsia will be a major feature of my life over the coming weeks, so perhaps I should be careful what I say. First impressions are not good. The online check-in software would have been out-of-date in the late 90s, and within an at the time completely empty plane, the algorithm assigns us seats 23A, 23B, 23C, 23D, 23E, 23F, 24A and 8F. Still, you get what you pay for, and we did not pay a lot at all. What we get is a flight to Thailand, during which we meet the Malaysian team, and our own students attempt one of the hardest outstanding problems from last year’s shortlist.

We arrive in Chiang Mai, and find an impressive greeting party from the IMO, who seem organised, keen to present us with garlands, and even more enthusiastic about taking photos than me. Our guide, Korn, leads us onwards to the Lotus Hotel, where the students will be staying for the duration of the competition. Our initial impression is that the rooms are lovely, the lobby is full of familiar faces, and the dessert is bright blue jelly. So far seems an excellent venue choice.

I’ve been in touch with BBC World about a live interview tomorrow morning. There’s been some confusion with photographs, so they are particularly keen to talk to Neel about his experiences as a girl attending international maths camps. Even in the event of finding an alternative narrative arc, the arrival of 600 technophile teenagers is putting strain on the hotel’s wifi. Skype seems a distant possibility, given the difficulty even in following an exciting first day of the (original) Ashes, featuring our second favourite prodigious Joe, via text. The Anglophone viewers of SE Asia will have to contain their excitement for now.

Thursday 9th July

We are up painfully early, in order to arrive painfully early at the opening ceremony. We have our first experience of songthaew, the ubiquitous red taxi minibuses. Though rather reminiscent of a police van, at least it’s a chance to get to know each other better. The team have brought their flags and brushed up smartly, and seem keen to pose with everyone who asks. Security is very tight – we are scanned repeatedly and our temperatures taken. We have a three hour wait, the giant hall is very stuffy, and it’s not clear whether we will be allowed to leave in a medical emergency. Five of the team work on C8, while Joe continues his quest to experience the first aid facilities at every IMO he attends. The room is very well-equipped, and the staff seem keen to use as much of the equipment as possible on Joe, but eventually they are persuaded that a horizontal surface and a glass of water will more than suffice in this instance. I find this gently air-conditioned room by some margin the most pleasant place in Chiang Mai so far.

All of this endeavour is for the benefit and protection of the princess, who as an enthusiastic supporter of STEM and enrichment is guest of honour. Her throne is suitably gold, and her entrance suitably Sheba-esque. Because of the presence of royalty, we are informed that our team procession across the stage must be formal – no projectile key rings this year. She departs with commensurate fanfare at the end of a remarkably short ceremony with a tragic lack of folkloric dancing, then there is the opportunity for more spontaneity, and an infinite number of photographs. The trend of the past two years that UK team members should carry others on their shoulders at such events seems to have become firmly established, to the chagrin of risk assessment form writers everywhere, though Sam and Warren appear reliable chariots this time. I try to ask as many of the officials as possible what their medals are for, but it’s tough getting many replies. I guess Thais are uniformly very heroic.

The afternoon stretches out somewhat, so we visit the Suan Dok temple, where everything is gold or brilliant marble. Apparently anyone who rings all of the many bells and gongs that line the perimeter will become famous, and some of our team gleefully test this hypothesis, to the annoyance of the many feral dogs who had been enjoying a mid-afternoon snooze in the grounds.

The students are keen for an early night, but not before a dance-off to some Thai music videos. While channel-hopping, they find coverage of the opening ceremony on the news, including a brief clip of our sashay and bow across the stage. We were not together. At all. Jill and I retire to the lobby, where no-one seems to have the heart to tell the hapless Elvis impersonator that he has forgotten to turn on his microphone.

Friday 10th July

The students are up fairly early for the first paper. They are allowed to take in a ‘talisman’ small enough to fit in their hand, and a kedondong each, lovingly rescued from Malaysia, seems the perfect choice. There is a mixture of nerves and excitement, but the algorithm for getting 500 contestants into 500 desks seems sensible, and so there is little for me to do except offer best wishes.

During the exam itself, the deputy leaders were whisked off to visit an elephant sanctuary. I remain ambivalent about the principle of teaching animals to perform tricks, but at least this show was tasteful, with a penalty shootout building to a triumphant climax unfamiliar to England fans, and a sequence of live paintings that were genuinely remarkable. I also take the chance for a short ride. It is clear that going uphill is a great deal more comfortable than lurching downhill, especially when steps are involved. It was a memorable experience to see these magnificent animals up close, and I hope the existence of such places helps towards conservation in the wild too.

We return to meet the students directly after the exam. Warren seems unimpressed by Q2, despite having solved it, while the others’ moods range from disappointed to bitterly disappointed. We move on though, especially since it will turn out that many comparable countries have a similar reaction to this question, for which the crucial division into cases is more tedious than one might hope for under competition time pressure.

Mindful that the hotel is likely to be rife with unhelpful gossip all afternoon, the UK team and Luke from Ireland head off for the old walled city in the centre of Chiang Mai. First a museum of the region’s cultural heritage, with plenty of information about basket-weaving, and some answers to Neel et al’s further questions about karma, such as whether it is a universal conserved quantity. The Lan Chang temple offers further sleeping dogs, gilded dragons and the chance to meditate on the fact that there’s more to life than technical number theory problems. We go again tomorrow.

Saturday 11th July

The second paper dawns. Neel and Joe seem to be competing to see who can wear the team polo shirt for the most days consecutively, so again we watch our mostly turquoise band file through the various entrances into the exam hall. The deputies have nothing to do this morning, so John from USA and James from Canada and I attempt to go walking up the lower reaches of the Doi Suthep mountain. Despite about 600,000 hits on Google for ‘Chiang Mai hike’, both our guides and the hotel staff tell us this is literally impossible, but recommend walking along the side of the three-lane highway instead.

The hikes mentioned online turn out to be literally entirely possible. I briefly slip flat on my back, and now have the exact imprint of a bottle cap in the middle of my spine, but otherwise it is entirely enjoyable. Lunch at a nearby restaurant offering North-Eastern Thai food is incredible, and it’s lucky the exam is finishing soon, otherwise I would have happily eaten twice my body weight.

We return to find the lobby overwhelmed with the news that today’s paper was hurriedly rewritten last night, after the original version was revealed accidentally to some DLs yesterday. The British students are again unhappy. It’s been a long year of enjoyable mathematics and worthwhile training, and no one likes to see it end in tears of frustration. But maths competitions are exciting precisely because sometimes even strong students struggle, and it doesn’t reduce the value of the mathematics they have experienced together during preparation.

While that might hold in abstract, in practice it seems sensible to find more active immediate distraction. We find a path to the bottom of a waterfall, then a trail to the top of the same waterfall through the jungle. Lawrence enjoys using a leaf almost as long as himself as a fan, and Warren, leading our march, regularly shakes a particularly luscious tree besides the path, to induce a refreshing shower onto those bringing up the rear. By the end, we are all sweatier, but I hope also more grounded about the cosmic importance (or not) of making the most shrewd substitutions in a functional equation.

Geoff is now allowed to see the students, and we enjoy a relief from rice with a rare Western meal, before I transfer to the leaders’ hotel, where we will be working hard at the scripts over the next few days.

IMO 2015 Diary – Part Two

 

Saturday 4th July

The morning brings double embarrassment. My weekend alarm is still on UK time, so I arrive at the practice exam a) late; and b) to discover that I’d already set a question from today’s paper for one of our selection tests in May. Andrew and I scramble to find a suitable replacement in the knowledge that this day can only get better.

The end of the exam brings news from the UK, in the form of an article about Joe in the Guardian, featuring punditry from Geoff, and a cameo quotation from Warren, quashing some of the more ludicrous claims in another recent account, which, though entertaining, is about as reliable as the Sunday Sport. Neel spends much of the rest day standing in front of a blackboard staring slightly off to the left into a strategically-placed desk lamp, practising for when his own moment of fame, and accompanying photoshoot comes about.

The UK students have lived up to their star billing, producing some stylish solutions to an algebra question, and marking is pain-free. After a slightly questionable Indonesian meal, Jill and I try to find the fruit our team have requested as exam refreshments. The closest thing I can find to grapes are kedondong, and these turn out to be almost entirely unlike grapes, with a hard leathery outside covering a hard woody inside. Harvey is unimpressed.

Sunday 5th July

These exams are not supposed to be especially comfortable, but those among us who sampled the chilli and peanut sauce last night now have 4.5 painful hours to ponder the consequences of our decisions. Today’s scripts are also rather bloated, with a set of competent but vague combinatorics essays to wade through. If Wagner wrote mathematical arguments, they would be like this: impressive length, with occasional dramatic conclusions separated by long passages where nothing of any importance really happens.

Wanting a break from the eternal air conditioning, Sam, Lawrence and I head for a walk through the suitably steamy path leading up the hill through the jungle behind the school. It doesn’t really lead anywhere except a radio mast, so we soon find ourselves back in the diplomatic precinct. This poses a map-reading challenge since every street is called ‘Diplomatic Street’. Furthermore, one cannot rely on landmarks since, despite the Malaysian government’s prompts, only Iraq has actually got round to building an embassy here.

I am pleased to see that our students are eating the kedondong, if only as the bankruptcy forfeit for their endless poker game, which I’m also pleased to see has displaced some of the more inane traditional maths camp card games.

Monday 6th July

To mix things up, today the UK students have chosen an exam paper for the Australians, which they mark in the early afternoon, and vice versa. The point of this exercise is to force the students to learn first-hand what makes written work easy to understand, or otherwise. Warren and Lawrence have a number of subtle ‘case bashes’ to check, but Australians Jeremy and Seyoon have the short straw, with another set of UK essays, this time about moving dominos around. However, they’ve really engaged with what our students have and haven’t done, so when Andrew and I check that everything is in order, there are no major surprises. This leaves time for me to give a short talk on the Lovasz Local Lemma, which is fairly well-received, though everyone seems surprised that so much extra machinery gets you only an extra factor of \sqrt{2} on the lower bound for Ramsey numbers.

As we have a bit more free time, Jill and I take the opportunity to visit Putrajaya’s two giant mosques. Jill’s efforts to dress appropriately ‘decently’ are in vain, as she is compelled to wear a giant burgundy hooded coverall for the duration. The stark ‘iron mosque’ includes a shopping arcade, and its main prayer room can fit 25,000 worshippers, who are I’m sure grateful for the air-conditioning hidden, our guide tells us, in the pillars. The Putra Mosque is just as pink on the inside, leaving Worcester College’s chapel green with envy.

Tuesday 7th July

It’s the final practise exam, deemed to be the Mathematical Ashes, which for the second time in three years finds itself well-timed in relation to its cricket counterpart. There is a both a trophy and an urn full of charred (mostly British) mathematics, which were only found hidden in a cupboard in Leeds last week, so they are not with us. Naturally, this has been interpreted as a sign of our confidence in retaining the title, and typical colonial arrogance.

It appears initially that no-one will be earning the title, as we are locked out of our usual classroom, and the alternative has plenty of sofas, but neither tables nor chairs. All is resolved quickly, and before too long, it’s time for another marathon bout of marking. About five hours later, Andrew and I have met to agree our marks and are able to make the dramatic announcement that this year we have a tie, on 84 points apiece. And no, we didn’t fiddle it. If nothing else, I’m definitely not good enough at addition to track these sorts of sums in my head.

And so the spoils, and the celebrations are shared. Our final Malaysian meal involves multi-coloured dim sum by the far side of Putrajaya Lake. Almost certainly the most greens some of the team have eaten all week…

ISL14 N6 – Sums of Squares of Intervals

I wasn’t able to post this at the time because of the embargo on discussing this particular question until the end of IMO 2015.

I’m currently enjoying the slow descent into summer in the delightful surroundings of Tonbridge School where we are holding our final camp to select the UK team for this year’s IMO. The mechanism for this selection is a series of four exams following the format of the IMO itself. We take many of the questions for these tests from the shortlist of questions proposed but not used at the previous year’s competition. In this post, I’m going to talk about one of these questions. Obviously, since lots of other countries do the same thing, there is an embargo on publication or public-facing discussion of these problems until after the next competition, so this won’t appear for a couple of months.

The statement of the problem is the following:

IMO Shortlist 2014, N6: Let a_1<a_2<\ldots<a_n be pairwise coprime positive integers with a_1 a prime at least n+2. On the segment I=[0,a_1a_2\ldots a_n] of the real line, mark all integers that are divisible by at least one of the numbers a_1,\ldots,a_n. These points split I into a number of smaller segments. Prove that the sum of the squares of the lengths of these segments is divisible by a_1.

I marked our students’ attempts at this problem and spoke to them about it afterwards. In particular, the official solution we were provided with, and which we photocopied and gave to our students contains some good theory and some magic. On closer inspection, the magic turns out to be unnecessary, and actually distracts a little from the theory. Anyway, this is my guided tour of the problem.

We begin with two items from the rough work that some students submitted. Someone treated the case n=2, which is not quite trivial, but not hard at all, and remarked, sensibly, that n=3 seemed to have become hard. Packaged with this was the implicit observation that for the purpose of the question posed, a_1 plays a completely different role to the other quantities. While this seems obvious when presented in isolation, it’s a good thing to say explicitly so that we avoid wasting time imagining symmetries which are definitely not present later. We’ll sometimes refer to a_1 as p, whenever we are using its primality rather than its other roles.

The second idea coming out of rough work was to consider what happens when an interval gets broken into two by a ‘new point’, whatever that means. In particular, what happens to the sum of the squares of the interval lengths modulo p? The way the student had set up this procedure suggested that the calculations would be easy in the case where the point being added was a multiple of p=a_1. This ended up being a red herring, because there’s no real reason why we would want to add the multiples of a_1 at the end.

It does, however, suggest an inductive argument, if instead you add the points which are multiples of a_n, but not of any of \{a_1,\ldots,a_{n-1}\}, because the latter would already be present. It might seem like induction is illegal, since there is the condition a_1\ge n+2 already present in the statement. However, once a_1 is fixed, if the condition holds for a particular n, then clearly it holds for all smaller n (!), and so we can use induction to build up to the value of n required in the statement.

Now we are happy this might work in principle, let’s do it in practice. We are adding all these multiples of a_n so we want to have some way to index them. One choice is to use their actual values, or the quotient by a_n, ie all the integers up to \prod_{i=1}^{n-1}a_i which are coprime to a_n. But maybe after thinking about it, there will be a more helpful way to index them.

We are only interested in non-trivial splittings of intervals. We might initially be concerned that an existing interval might be split into more than two sub-intervals by the addition of the multiples of a_n, but the ordering suggested in the statement means this can’t happen. In general, let the initial size of the interval be K, and the sizes of the two sub-intervals be x and y for reasons which will become clear. Then the change in contribution to the total sum of interval lengths squared is given by

K^2 \quad \mapsto \quad x^2+y^2= K^2 - 2xy,

using that K=x+y. So the total change when we add all the multiples of a_{n} will be the sum of 2xy over all the intervals which get divided into two.

Now we have the challenge of evaluating this sum, or at least showing that it is divisible by p. Given a multiple a of a_1, what will x be?

Well, on the left of a, the distance to the nearest multiple of a_k is the remainder r_k of a on division by a_k, essentially by definition. So x will be the minimal such remainder as k varies. Similarly, y will be \min_k (a_k-r_k). We forget about the minus sign and the factor of 2 forever, since it doesn’t make any difference unless p=2, in which case we are already done, and so we now have our sum:

\sum_{a\text{ a new multiples of }a_n} \left( \min_i(r_i)\right) \left[ \min_j(a_j-r_j) \right].

Now we return to the question of how to index the new multiples of a_n. But the question’s easier now as we have some clues as to what might be useful. Each of the summands involves the remainders modulo the smaller a_is, so can we use these as part of the indexing?

Yes, of course we can. There’s a bijection between the possible sequences of remainders, and the new multiples of a_n. This is basically the statement of the Chinese Remainder Theorem. Our index set should then be

r_1,\ldots,r_{n-1} \in [1,a_1-1]\times\ldots\times [1,a_{n-1}-1].

Remember that the fact that they are not allowed to be zero is because we only care now about new points being added.

Even now though, it’s not obvious how to compute this sum, so the natural thing to try is to invert our view of what we are summing over. That is, to consider how many of the index sequences result in particular values of x and y. Given x and y at least one, each remainder r_k must lie in [x,a_k-y], ie there are a_i-(x+y)+1 values it is allowed to take. So our guess for the number of such indices might be \prod_{i=1}^{n-1} (a_i-(x+y)+1), which is indeed what I wrote up on the board before Neel pointed out that some of the sequences I’ve allowed do not actually attain this minimum.

Fortunately this is easily fixed. If the minimum for x is not attained, we know that r_k\in[x+1,a_k-y], and similarly for y. So we can apply the inclusion-exclusion principle to depth two to say that the number we actually want is

\prod_{i=1}^{n-1} (a_i-(x+y)+1) - 2\prod_{i=1}^{n-1} (a_i-(x+y)) + \prod_{i=1}^{n-1} (a_i-(x+y)-1).

This is a polynomial in (x+y), so we’ll call in P(x+y). We’ll come back to this expression. We still need to tidy up our overall sum, in particular by deciding what bounds we want on x and y. Thinking about the intervals of width p, it is clear that the bounds should be 1\le x,y and x+y\le p. So we currently have our sum as

\sum_{1\le x,y,\,x+y\le p} xy P(x+y),.

If you’ve got to this stage, I hope you would feel that this seems really promising. You’ve got to show that some sum of polynomial-like things over a reasonably well-behaved index set is divisible by p. If you don’t know general theorems that might confirm that this is true, once you’ve got statements like this, you might well guess then verify their existence.

First though, we need to split up this xy term, since our sum is really now all about x+y, which we’ll call z.

\sum_{2\le z\le p} P(z) \sum_{x+y=z,x,y\ge 1} xy.

Once we’ve had our thought that we mainly care about polynomials mod p at this stage, we might even save ourselves some work and just observe that \sum_{x+y=z}xy is a cubic in z. This is definitely not hard to check, using the formulae for triangle numbers and sums of squares. It’s also reasonable to conclude that the value of this is 0 for z=1, so we can change the indices on the sum so it doesn’t look like we’re missing a term. So we have

\sum_{z=1}^p P(z) Q(z),

where Q is some cubic, which we could work out if we really wanted to. But what’s the degree of P? P is made of a sum of 3 polynomials whose degree is clear because they are a product of linear factors. So each of these has degree (n-1), but in fact we can clearly see that the leading term cancels, and also with a tiny bit more care that the second order terms cancel too, so P has degree at most n-3.

[Tangent: students might well ask why it is convention to take the degree of the identically zero polynomial to be -\infty rather than zero. The fact that the above statement is true even when n=2 is a good justification for this.]

[Tangent 2: In my initially erroneous evaluation of the number of remainder sequences, without the inclusion-exclusion argument, I indeed ended up with P having degree n-1. I also worked out Q as being quadratic though, so my overall necessary condition was only one off from what was required, showing that two wrongs are not as good as two rights, but marginally better than only one wrong.]

Anyway, we are taking a sum of polynomials of degree at most n \le p-2. This is the point where one might get confused if you have been specifying everything in too much detail. The fact that I’ve said nothing about the polynomials apart from their degree is predicated on the fact that I now know I only need to only their degrees for what I want, but even if you had tracked everything very explicitly, you might still guess what to do at this stage.

It’s presented as a lemma in the official solution that if you have a polynomial of degree at most p-2, then \sum_{z=1}^p P(z)\equiv 0 modulo p. There are several ways to see this, of which a proof by induction is easiest to believe, but probably least intuitive. It’s clear what goes wrong for degree p-1 by FLT, so you probably want to look at the set \{z^k: z\in[1,p-1]\} modulo p. It won’t necessarily be all the residues modulo p, but thinking about primitive roots, or the roots of unity makes it fairly clear why this would be true. [Essentially any argument that turns multiplication into addition in a well-behaved way clears this up.]

The most important point is that this lemma is a) easy-ish and b) a natural thing to try given where you might have got in the question at this stage. From here you’re now basically done.

I don’t think this is an easy question at all, since even with lots of guiding through the steps there are a lot of tangents one might get drawn down, especially investigating exact forms of polynomials which it turns out we only need vague information about. Nonetheless, there are lots of lessons to be learned from the argument, which definitely makes it a good question at this level in my opinion.