The Maths of Doctor Who #2 – “Don’t they teach recreational mathematics any more?”

The Ambassadors Of Math (twang!)

Over its long and varied history, Doctor Who has had a few mathematically minded writers producing scripts for the show. Perhaps you would say that the most prominent of these is Christopher H. Bidmead, who served as script editor during the show’s eighteenth season, the last to feature Tom Baker as the incumbent Doctor, and also produced three scripts for the show: Logopolis (1981), Castrovalva (1982) and Frontios (1984). The first of these concerns itself with a society of mathematicians holding the universe together (indeed, Toby Hadoke has jokingly referred to this serial as ‘The Maths of Death’ on his Who’s Round podcast), whilst the second one draws upon the mathematically themed artwork of M.C. Escher. The third one has some funky gravity shenanigans. A near hat-trick then.

Looking more recently at the revived era of the show, Stephen Thompson (sometimes credited as Steve Thompson) also has a background in mathematics, as he himself was a former maths teacher before entering television writing. He has previously talked to the media about how the plotting of Time Heist (2014) was somewhat based around the River Crossing Problem, a classic logic problem involving the transportation of a fox, a hen and a bag of grain, and the movie-style poster specially made for Journey to the Centre of the TARDIS (2013) also has strong M. C. Escher vibes (or Castrovalva vibes, if you prefer).

However, I would actually argue that the most mathematical writer is none other than the current showrunner himself, Chris Chibnall. Three of the episodes penned by him so far have made reference to three distinct groups of numbers: happy primes in 42 (2007), cube numbers in The Power of Three (2012), and pentagonal numbers in The Tsuranga Conundrum (2018). Even more curiously, if you look at the order of solo-penned Chibnall episodes (meaning we ignore Rosa (2018) here) then each of these episodes is separated by three episodes without a numerical reference.

Should this pattern continue into the next series of the show, then that would mean Spyfall: Part Two (2019) should be the next Christ Chibnall episode to have a numerical reference. Will this trend continue to hold? Watch this space. I am also willing to propose another conjecture on the back of this here:

Chris Chibnall is actually the most mathematical writer in the history of (televised) Doctor Who. So far.

In order to examine this suggestion, let’s travel back in time and have a look at each of these mathematical references from the aforementioned Chibnall-penned episodes in turn and see if we can learn anything along the way. After all, Doctor Who has its very roots in educating the kids about science and history during Saturday teatime viewing, but why stop at those subjects? Why not keep the learning streak going? Why break the habit of a lifetime? (Or is it several lifetimes?) I’d like to think one more lesson wouldn’t hurt anyone. I’ll start with the most recent of the three…

Count on a Bomb, It’s Fifty-One!

The Tsuranga Conundrum: Or How I Stopped Worrying And Love the Pting.

In the climatic moments of The Tsuranga Conundrum, the Thirteenth Doctor and Yasmin plant a bomb in an escape pod as part of a trap for the Pting, who has been menacing them throughout the episode by eating parts of the spaceship. It’s at this particular point that the Doctor decides to utilise Yaz for a bit of Random Number Generation (RNG)1:

DOCTOR: Pick a number between 1 and 100.


DOCTOR: Pentagonal number. Interesting.

DOCTOR: Get in that corner.

YASMIN: What was the number for?

DOCTOR: Number of seconds before the bomb goes off. I moved it forward a bit.

YASMIN: What? I would’ve gone higher!

Humans aren’t particularly random when it comes to picking a ‘random’ number, with some numbers being far more preferable than others. A reddit user asked people to pick a random number between 1 and 100 and after thousands of responses the top three responses (in third, second and first respectively) were 7, 77 and 69. People appear to have a fascination with the number seven as ‘the most random number’ (and indeed, some appear to have a juvenile sense of humour).

It also seems that more often than not people go for odd numbers rather than even numbers, and prime numbers rather than composite (non-prime) numbers. Here we can see that Yaz has also picked an odd number but it isn’t prime since 51 = 3 x 17, though it can be mistaken for being prime given that similar-looking numbers like 11, 31, 41, 61 and 71 are all prime. I hope to write more on random number generators and their use in the episode Extremis in a later blog post, but let’s get back on track here.

Perhaps frustratingly for a mathematician like myself, the Doctor never actually defines what a pentagonal number is within the episode. Whilst Chibnall in Series 11 could be seen to be harking back to the William Hartnell days with a triage of companions and alternating the adventures between sci-fi and historical (if you ignore the episodes set in the present day), he could go one step further by including such definitions to strengthen the ‘educating the kids’ part that here. But no matter, this is where I come in!

Before we actually get onto pentagonal numbers, let’s start off with a simpler but related group of numbers: the triangular numbers. Triangular numbers are the number of dots needed to make an equilateral triangle of increasing side length. This is more easily seen using a diagram so below here is one I’ve borrowed from Wikipedia. The first triangle (T1) has just the one dot for each side, the second triangle (T2) has two dots for each side so it needs three dots altogether, the third triangle (T3) has three dots for each side so it has six dots altogether, and so on. You may have also noticed that you can predict these by counting the first n whole numbers (1 = 1, 1 + 2 = 3, 1 + 2 + 3 = 6, 1 + 2 + 3 + 4 = 10, 1 + 2 + 3 + 4 + 5 = 15, etc).

The first six triangular numbers. Source: Wikipedia.

Naturally, we can extend this to other shapes. The square numbers are similarly the number of dots needed to make a square of increasing side length, though you may also recognise them as the numbers you get when you multiply every whole number by itself (1 x 1 = 1, 2 x 2 = 4, 3 x 3 = 9, 4 x 4 = 16, 5 x 5 = 25, etc). And then we get to pentagonal numbers which are, as you’d expect, the number of dots needed to make a pentagon with increasing side length. Unfortunately, the general formula is not quite as straightforward as the previous groups; the nth pentagonal number is actually equal to (3n2 – n)/2. The first six of these are 1, 5, 12, 22, 35 and 51, so we now know that 51 is not just any pentagonal number; it’s the sixth pentagonal number.

And the first six pentagonal numbers – Source: Wikipedia

This has left me somewhat annoyed because The Tsuranga Conundrum was the fifth episode broadcast but it was the seventh episode to enter production, though I suppose it’s the sixth appearance of Jodie’s Doctor if you include Twice Upon A Time. If you can find some other possible hidden meaning as to why it’s the sixth pentagonal number, then leave me a comment down below.

That’s The Power of Three

The Power of Three: Did you know… the BBC tried to see these cubes at £39.99 a piece!?!

Next up we have The Power of Three, an episode from 2012 that features the “invasion of the very small cubes”, as the Doctor quite succinctly puts it. Whilst the story is largely concerned with this unusually slow invasion and the Doctor having to spend time living on Earth with Amy and Rory, the maths reference here comes in right at the end of the episode’s final scene:

AMY: So that was the year of the slow invasion, when the Earth got cubed, and the Doctor came to stay. It was also when we realised something the Shakri never understood. What cubed actually means. The power… of three.


If you listen very carefully, you can still hear the audible groans of people who witnessed that last line to this day…

We’ve already talked about square numbers, the sequence of numbers where each integer is raised to the power of two, and similarly you can get the sequence of cube numbers, sometimes referred to as just ‘cubes’, by just raising to the power of three instead (13 = 1 x 1 x 1 = 1, 23 = 2 x 2 x 2 = 8, 33 = 3 x 3 x 3 = 27, etc). Given that the world we live in consists of three dimensions (at least, it did the last time I checked), an understanding of cube numbers helps us to understand space and volume as well, so it’s certainly handy stuff.

Mathematicians have been fascinated for centuries by what we can and cannot do with cubes. For example, it is a proven fact that there is no cube number that can be written as the sum of two other cube numbers. This is in accordance to Fermat’s Last Theorem, a maths problem that was only solved relatively recently in the history of maths by Sir Andrew Wiles in 1997, around 358 years after the problem was first proposed by Pierre de Fermat himself! This precise theorem was also referenced by the Eleventh Doctor during his Skype conference in The Eleventh Hour in order to demonstrate how intelligent he is by claiming to have ‘the real proof’ for it.

The Eleventh Hour: A prime example of how an impromptu maths conference can save the world.

This in itself is a reference to the proposed existence of a more straightforward proof that Fermat could have potentially conceived, as he once famously claimed to “have discovered a truly marvellous demonstration of this proposition that this margin is too narrow to contain” – a hilariously outrageous statement for someone who hardly ever bothered to rigourously prove his mathematical discoveries (perhaps I’ll cover his biographical life in more detail within a future blog post – stay tuned!). Anyway, the proof devised by Wiles at the end of the twentieth century used mathematics far beyond what was known hundreds of years ago and so it seems that his rather simple proof either never existed (which is my personal belief) or it is indeed forever lost to the mists of time…

Unless you’re an alien time traveller from the planet Gallifrey, of course.

Another quite interesting fact is that it is impossible to ‘double the cube’, that is to geometrically construct a cube that has precisely double the volume of another cube, since the cube root of two is not a ‘constructible’ number. If you’d like to learn more about constructible numbers as well as the tragically ignored mathematician who discovered this truth, check out my previous maths blog post on Flatline and the number pi here.

Platonic Relationships

Cubes also belong to a rather select group of objects known as the Platonic solids. A Platonic solid is defined as ‘a regular, convex polyhedron’. To put this more plainly, that means any 3-D solid where every side is the same regular polygon (so the square sides on a cube for example) and that all the sides around the solid and all the angles within the solid are ‘congruent’, meaning simply that they are just the same size.

The precise origin of this concept is unknown as it can be traced as far back as to several ancient civilisations, and even authorship of the idea within Ancient Greek society is disputed, with some sources suggesting they should be referred to as Pythagorean solids rather than Platonic. There are only five Platonic solids: the cube (or hexahedron), the tetrahedron, the octahedron, the icosahedron, and the dodecahedron.

The Gang’s All Here: The Five Platonic solids as dice.

Any fans of board games or role-playing games might recognise these shapes as the shapes of dice used when playing these games: a tetrahedron is a four-sided die, a cube is a six-sided die, an octahedron is an eight-sided die, a dodecahedron is a twelve-sided die, and an icosahedron is a twenty-sided die. Their natural geometric properties make them ideal for games of chance where the probability of rolling each number should be equally likely, and also you might find them quite aesthetically pleasing to look at!

The mention of a dodecahedron also brings up an unexpected connection to the 1980 Tom Baker serial Meglos, a story that sees a shape-shifting cactus from Zolfa-Thura attempting to steal the power source of the planet Tigella, which happens to take the shape of a dodecahedron. The power source was originally meant to be in the shape of a pentagram according to the writers Flanagan and McCulloch, but was changed at the insistence of the then-script editor Christopher H. Bidmead.

It is perhaps worth observing that a pentagram is a star with five points which itself has symbolic links to the societies of Ancient Greece, and this may have then prompted the mathematically-literate Bidmead to suggest a Platonic solid instead. He also chose the dodecahedron; the only Platonic solid made up of five-sided shapes, those being regular pentagons. Arguably, this is his way of keeping to some of the writers’ original idea whilst still changing it to something he much more preferred.

The story of Meglos also concerns the ongoing dispute between two opposing groups: the scientific Satants, who utilise the Dodecahedron as a source of energy for the society, and the religious Theons, who believe the Dodecahedron is a crystalline gift from the great god Ti. This may also have further stimulated Bidmead to choose a Platonic solid for the shape that acts as a power source but also an object of worship since archaeologists and anthropologists have referred to the Platonic solids as “sacred geometry”.

The group of Platonic solids are recognised by cultures throughout history as having ‘divine properties’, and were well known amongst famous scientific societies, like the Ancient Greeks and Babylonians, as well as famous scientific thinkers such as Leonardo da Vinci. The five solids were believed to represent the four major elements and the universe: the tetrahedron represents fire, the cube represents earth, the octahedron represents air, the icosahedron represents water, and the dodecahedron represents the universe2. It seems unsurprising yet again that Bidmead chose this particular solid over the other four candidates.

The Sacred Texts: Da Vinci’s drawings of the five Platonic solids, and a sphere.

This observation actually rather neatly brings us back to The Power of Three once again, which started the discussion of this entire subsection. Here, the plot in this story involves the Shakri using cubes to gather knowledge about planet Earth and the behaviour of the human race before using this information to invade more tactically. Could it be that the Shakri themselves knew about the history of Earth civilisations that led them to choose the cube as the symbol of their invasion of Earth, or does the cube represent something entirely different to them? And could it be that the writer Chris Chibnall consciously chose the shape of the cube here, given that it symbolises the earth, further cementing my theory that he is in fact Doctor Who’s most mathematical writer?

The Answer To Life, The Universe, And Also The Pub Quiz

School of Hard Suns: The pub quiz trivia knowledge here is absolutely on point.

Lastly, we come to what is probably the most overt maths reference in the history of modern Who so far (at the time of writing this Series 12 has yet to broadcast so this could well change in the near future), and it comes from Chris Chibnall’s Doctor Who writing debut. The episode 42 (2007), which incidentally is the only Doctor Who episode title to consist of solely just a number3, takes place in faux real time (oxymoron much?) as the Tenth Doctor and Martha have just 42 minutes to help a cargo spaceship called the SS Pentallion avoid crashing into a nearby sun.

To do this, Martha teams up with crew member Riley to work their way through thirty deadlocked doors in order to reach the ship’s controls, and each door will only open if they correctly answer a pub quiz question set by members of the crew. Almost nine minutes into the episode’s 45-minute runtime and we get the following dialogue exchange that has been immortalised, if not quite correctly transcribed, by this selection of GIFs on the Official Doctor Who Tumblr page4 .

RILEY: Find the next number in the sequence: 313, 331, 367, …? What?

MARTHA: You said the crew knew all the answers.

RILEY: The crew’s changed since we set the questions.

MARTHA: You’re joking.

DOCTOR: 379.


DOCTOR: It’s a sequence of happy primes. 379.

MARTHA: Happy what?

DOCTOR: Just enter it.

RILEY: Are you sure? We only get one chance.

DOCTOR: Any number that reduces to one when you take the sum of the square of its digits and continue iterating until it yields one, is a happy number. Any number that doesn’t, isn’t. A happy prime is a number that is both happy and prime. Now type it in! I don’t know, talk about dumbing down! Don’t they teach recreational mathematics anymore?

At last, we have an episode that provides the definition of a mathematical concept mentioned within the actual dialogue – hurrah! Education is back on the agenda. But perhaps you still find this a little too technobabble for your tastes, so let’s expand a bit on the explanation given by the Doctor. And since I’ve already covered what prime numbers are back when I discussed The Tsuranga Conundrum earlier so I’m going to focus exclusively on happy numbers here.

The best way to see how happy numbers work is to go through an example so I’m going to pick the number 28. To check if 28 is happy, I need to add the square of each digit in 28 in an iterative sequence and see if we reach the number one. You should already know what square numbers are because I’ve covered those earlier in the blog as well (Isn’t planning a wonderful thing?).

22 + 82 = 2 x 2 + 8 x 8 = 4 + 64 = 68

It is clear that 68 is not the number one, so we have to repeat the process again:

62 + 82 = 6 x 6 + 8 x 8 = 36 + 64 = 100

Again, this isn’t the number one so we try one more time:

12 + 02 + 02 = 1 x 1 + 0 x 0 + 0 x 0 = 1 + 0 + 0 = 1

This shows not only that 28 is a happy number, but also every number along this sequence is also happy, meaning 68 and 100 are also happy numbers. And since the order of the digits does not matter when calculating these, it is also clear that 82 and 86 are also happy numbers. Below I’ve borrowed a handy tree diagram from the STEM Learning website that shows all of the happy numbers between 1 and 100.

Happiness Will Prevail: All of the happy numbers between 1 and 100.

But what about the unhappy numbers, such as 2, 16, and 89? Well if you try this iterative process of adding the squares of digits with them, you will end up in a never-ending sequence of numbers, as you will never reach the number one. I’ve also included this other handy tree diagram from the STEM Learning website that shows all the unhappy numbers between 1 and 100. Notice that all the numbers pictured below all eventually end up in a cyclical loop shown by the dark blue numbers at the centre: 145, 89, 58, 37, 16, 4, 20 and 42. Rather tragically, it seems that 42 is in fact an unhappy number5. We can cap off this explanation by recalling that “a happy number is a number that is both happy and prime”.

Side by side with sadness: All the unhappy numbers between 1 and 100, and a few greater than 100 too.

And as if that wasn’t enough, Chibnall’s scripting of episodes entitled 42 and The Power of Three perhaps pre-empted a previously undiscovered link between the two ideas, that is until 2019. Since 1954, mathematicians have been able to write every number between 1 and 100 as the sum of three cubes, except for one particular number – 42. Whilst some have conjectured (starting with Roger Heath-Brown in 1992) that every whole number can be written as the sum of three cubes this has yet to be proven, but a recent discovery has brought some hope. A computer algorithm in September 2019 found the first ever set of three cube numbers that sum to 42, as if you look at the thumbnail below you can see they are pretty large ones as well – no wonder it took us so long to find! There’s still much work to be getting on with in the world of number theory but for a small group of mathematicians on that day of discovery, 42 was indeed the answer to Life, the Universe and Everything.

Teaching Recreational Mathematics In A Fun But Irreverent Way

By examining three episodes penned by Chris Chibnall, we have ended up discussing triangular, square and pentagonal numbers, cube numbers, as well as happy numbers and prime numbers. We have also talked about the importance of the cube as one of the five Platonic solids, linking it to the 1980 serial Meglos, which also features a Platonic solid and was script-edited by a writer with a penchant for science and mathematics, and then discovered that the cube itself is an ancient symbol for the earth element. All of this has led us to the lament of the Tenth Doctor, and the title of this very blog: “Don’t they teach recreational mathematics anymore?”

It’s hard to be sure what he exactly means by the term ‘recreational mathematics’ here; some would even argue this is an oxymoron. I am somewhat amused by the definition for this term given by Wikipedia: “Recreational mathematics is mathematics carried out for recreation (entertainment) rather than as a strictly research and application-based professional activity”. Evidently whoever wrote this had not really considered the likes of Fermat who, despite becoming one of the big names within mathematics, largely played around with numbers in order to pass the time. The term ‘recreational’ seems to allude to an idyllic notion that maths can be an enjoyable pastime and/or something done for non-academic purposes6, like trying to solve BBC Radio 4’s Puzzle For Today, or just simply finding unusual number patterns and sequences, such as happy primes for instance. I personally rather enjoy thinking and learning mathematics, but it sadly seems rare that other people feel the same way.

Nevertheless, while the definition of ‘recreational mathematics’ seems to leaves us in ambiguity, I feel the definition of Chris Chibnall as a ‘mathematical writer’ for Doctor Who is actually far from being ambiguous, most certainly when stood in comparison to the pantheon of writers throughout the show’s 56-year history (and counting!). If you still doubt my claim that Chibnall is indeed the most mathematical writer, rather than the likes of Bidmead or even Thompson, then consider my one final point on the matter.

Perhaps when, as the SS Pentallion hurtles towards an all-consuming sentient fireball, the Tenth Doctor cries out about the lack of recreational mathematics in the education of those from either the 21st or 42nd centuries, it isn’t actually the vain, pompous and arrogant voice of the Tenth Doctor speaking here. Perhaps instead, it is the vain, pompous and arrogant voice of the then future Doctor Who showrunner Chris Chibnall bleeding into the script right here, as he tries to bring the show back to its early educational roots7. I hope he hasn’t changed his mind.

[UPDATE: The episode Spyfall: Part Two featured an early counting machine, Charles Babbage and The Enchantress of Numbers herself, Ada Lovelace – I see this as an absolute win!]

All references are linked or specified throughout the article.


1 All episode quotes throughout this blog are my own transcriptions based on viewing them.

2 For more background on platonic solids as ‘sacred geometry’, have a read of this Mathematics Magazine blog post.

3 The next closest in my mind is 100,000 BC as an alternative serial title for An Unearthly Child, but this itself is a year rather than a number. Also, Chibnall is the only writer to have two episodes with a number in the title (42 and The Power of Three).

4 Don’t forget to click below to reblog the Official Doctor Who Tumblr page.

5 For a bit more background to happy and unhappy numbers, have a read of this STEM Learning blog post here.

6 For more content on recreational mathematics, have a read of this New York Times article.

7 If Chris wants to combine the show’s educational roots with the demands of a modern audience – is there Space For Chib ‘n’ All?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s