Back to school you lot...

Bletchley was crammed with top chess players.

A lot of people at Bletchley were top crossword experts too with a fair smattering of polyglots.

For a quick maths lesson:-

This is the 'original sequence': 12 26 46 72 104 142

The 'first differences' are, funnily enough, the differences between successive terms in the 'original sequence': 14,20,26,32,38

The 'second differences' are, funnily enough, the differences between the terms of the 'first differences': 6,6,6,6

To build a general formula we observe:

x

_{1}=12

x

_{2}=12+8+6

x

_{3}=12+(8+6)+(8+6+6)

x

_{4}=12+(8+6)+(8+6+6)+(8+6+6+6)

So, for x

_{n} we have 12 plus 8*(n-1) plus a number of 6's that correspond to the 'triangular numbers' (1,1+2,1+2+3,1+2+3+4,1+2+3+4+5,... == 1,3,6,10,15,...) which we all know the formula for that. Think of the triangle like this:-

6

66

666

6666

To calculate the number of 6's we imagine a similar triangle spliced on to it to make a rectangle:-

6xxxx

66xxx

666xx

6666x

This makes a rectangle of size 4 * 5, of which the 6's make up only half. So a triangle of size has 4*(4+1)/2 elements or, in the general case: n*(n+1)/2

In this case the input is n-1, (with n=1 we have no 6's) so the formula for the number of 6's in x

_{n} is (n-1)*(n-1+1)/2 = n(n-1)/2

So: x

_{n} = 12 + 8*(n-1) + 6*n*(n-1)/2

= 12 + 8*(n-1) + 3*n*(n-1)

= 12 + 8n - 8 + 3n

^{2} - 3n

= 3n

^{2} + 5n + 4