7 ways to tell if a number is divisible by 7

I’m sure you know how to check if a huge number is divisible by 3, 9, 11 or by powers of 2 like 2, 4, and 8; you were probably taught how to do this in primary school. However most of you were probably never taught how to test whether a number is divisible by 7. In this article we will explore seven different ways to do that.

7 is by far the least-loved single digit number when it comes to divisibility. Image: Chalkdust

Before we start, let’s introduce some notation which we’ll use throughout the article. An $n$-digit number $N$ in decimal base 10 is a number with digits belonging to the set $C_{10}=\{0, 1, 2, 3, 4, 5, 6, 7, 8, 9\}$ and can be expressed as sum of powers of 10: $N=\sum_{i=0}^{n-1}10^ic_i, $ where  $c_i \in C_{10}$. We normally write this number by concatenating the digits using their position to indicate the corresponding power of 10: $c_{n-1}c_{n-2}\cdots c_1c_0$. The least significant digit of $N$ is $c_0$, and most significant digit is $c_{n-1}$. Continue reading


Christmas puzzles: the solutions

To celebrate Christmas this year we released a sequence of three linked puzzles on Christmas Eve, Christmas Day, and Boxing Day. If you haven’t had a chance, do give these puzzles a go! If you have tried these puzzles and would like to see the solutions, please read on.

Puzzle #1: Christmas tree sudoku

If you haven’t tried solving a so-called thermo sudoku before, getting an intuition for how the thermometers work is key. Notice that if a $1$ lies on a thermometer it must lie on the bulb, and if a $9$ lies on a thermometer it must lie at the end. This gives a good way to start the puzzle, looking at the third row from the bottom where can a $1$ go? Once you are about a third of the way into this puzzle, it more-or-less turns into a normal sudoku and is relatively straightforward to complete. Contrary to normal practice when designing a sequence of puzzles like this, this was possibly the hardest of the three puzzles. That’s why we made it so that you could still solve puzzle #2 without solving this one. Continue reading


Christmas puzzle #3: Colouring by numbers

Happy Boxing day! That means it’s time for the third and final Chalkdust Christmas puzzle. We hope you have been enjoying them so far! You can find the first two puzzles here and here.

The rules

  • Below is a 15×20 grid and each square contains a digit 0–9. Your job is to colour in each of the squares according to the rules below.
  • If a square has already been coloured in as part of a previous rule, then it, together with the digit it contains, should be ignored—in other words you should apply the rules in the order they are given, and only to the remaining white squares.
  • Numbers clued by a given rule may overlap, so a digit can be part of several answers corresponding to the same colour.
  • Where a rule is of the form ‘Colour all numbers of type $x$ colour $y$’, the numbers will appear either horizontally left-to-right, or vertically top-to-bottom, never reversed or along diagonals.
  • None of the rules refer to numbers which start with a 0.
  • Use of Python, OEIS, Wikipedia, etc. is advised for some of the clues.

Continue reading


Christmas puzzle #1: Christmas tree sudoku

Here at Chalkdust, we like to celebrate Christmas as much as the next magazine for the mathematically curious, and what better way to celebrate than with a few yuletide mathematical puzzles. We have three for you, the first one you can find below, the second one will be published tomorrow (Christmas Day), and the final one the day after (Boxing Day). They are the perfect accompaniment to an warming hot chocolate and mince pie. Each puzzle is related to the previous one, so keep a hold of your solutions ready for the next day. We hope you enjoy giving them a go and the whole team wishes you a very merry Christmas!

The rules

  • Normal sudoku rules apply: you must complete the 9×9 grid with the digits 1 to 9 such that each digit appears exactly once in each row, column, and 3×3 block.
  • The digits that appear on each thermometer must strictly increase as you move away from the bulb. The colours of the thermometers are purely decorative and do not affect the puzzle.
  • The digits on the baubles are all even.
  • The digits on the stars are all prime.

Continue reading


Revisiting the 1986 computer classic Number Munchers!

Ready to play Number Munchers. Image: ©MECC 1990, reproduced for the purpose of review.

If you were a child in the eighties or nineties, you might have seen the educational game Number Munchers on your school PC. It was originally released by MECC in 1986, and was re-released several times (for MS-DOS, Apple, and more). Nearly three decades later, Number Munchers received a Readers’ Choice Award in 2005 from Tech and Learning.

Believe it or not, I didn’t play it as a kid—rather I just watched a classmate play the 1990s version on a Macintosh. It wasn’t until two decades later (read: last winter) when I had a go at playing it. I couldn’t find the Macintosh version of the game, but I did come across the older MS-DOS version, so I played that.

Yum, yum!

The controls are quite straightforward—just use the arrow keys to move your green muncher around, and the space bar when it’s time to eat a number. Granted, most games I have played are for the PC, so I find keyboard controls easy to use.

Your green guy is sitting in a 5 by 6 grid, and each square on the grid contains a number. You get points by eating numbers that satisfy the rule given on the top of the screen. Meanwhile, if you eat a wrong number, you lose one life. The game ends when you run out of lives. Example rules include:

  • Multiples of 5: eat 5, 10, 15, etc
  • Factors of 14: only eat 1, 2, 7 and 14
  • Prime numbers: eat primes
  • Equals 6: you get expressions such as $6\times 1$, $3 + 0$, and need to pick the ones that equal 6
  • Less than 12: eat only the numbers 1–11

There’s even a challenge mode that lets you mix and match the rules! Moreover, there are lots of difficulty levels to pick from. There are 11 levels in total; they start at ‘third grade easy’ (that’s year 4 for Brits like me), and go all the way up to ‘seventh grade easy/advanced’, and finally eighth grade and above.

Number Munchers features five fearsome foes to fight or flee. Image: ©MECC 1990, reproduced for the purpose of review.

You will also want to avoid the Troggles—they are the monsters who want to eat your little muncher! It’s another surefire way to lose a life. When I first saw the game as a child, I didn’t notice that there were five types of Troggles, each coming in different colours and walking in specific patterns. I also forgot that when a Troggle walks over a square, it leaves a new number behind. If that’s not challenging enough, things start to get more frantic in later levels. More Troggles will turn up on the same board, and they’ll move faster, so you’d better be quick on your feet or have picked an easy maths mode! You’re also more likely to see what happens when Troggles meet: one eats the other, then the surviving Troggle continues walking as if nothing happened.

The Troggles at it again in this cutscene. Image: ©MECC 1990, reproduced for the purpose of review.

When you’ve eaten all the numbers on the board that fit the rule, you get to move on to the next level! Also, every three or four levels you get treated to a funny cutscene featuring the muncher and the Troggles! In most of the cutscenes, the Troggles try to capture the muncher, only for the plan to backfire, so the muncher gets the last laugh! You can even hear the muncher a little jingle, as if they were singing “Nyah-nyah-nyah-nyah-nyah-nyah!” Apparently there are at least five more fun cutscenes out there. No, not all of them feature Troggles. Sorry Troggle fans!

My favourite mode

As a schoolgirl I watched my classmate play the level where you only eat prime numbers, and the moment he lost a life. No—he did not get eaten! The disaster was what he ate…the number 1. The game then said that 1 is not prime, but didn’t explain why.

Late breaking news from Number Munchers: 1 is not prime! Image: ©MECC 1990, reproduced for the purpose of review.

Then the teacher’s assistant was watching too. When the muncher lost a life, she turned to me and asked, “Why do you think the number 1 is not prime?”. How was I supposed to know? I was only just starting to learn what a prime number is! I was aware that a prime is divisible only by 1 and itself, but didn’t realise that these two divisors should be distinct. It only dawned on me years later, but I’d already moved into secondary school by then!

This is why the prime numbers round became my favourite level in the game. It showed me a something I didn’t realise until then, and made me go “ooh”. And now I’m older, I’m having no difficulties with the prime level…as long as there are no three-digit numbers!


Number Munchers is definitely one of those maths games that can be enjoyed by people of (almost) all ages. Just make sure you didn’t pick the hardest difficulty setting! I did that, and I instantly regretted it—I found myself struggling to figure out which of the three-digit numbers I got were multiples of 19! It didn’t help that I initially misread the question, and thought I was supposed to avoid said multiples! An easy way to throw a life away. And as if I didn’t have enough to do already, I had to keep dodging the Troggles to make sure I didn’t eaten! Unsurprisingly I gave up, and switched to an easier setting.

We do not recommend starting with this mode. Image: ©MECC 1990, reproduced for the purpose of review.

If you’re after graphics, I recommend the 90s Apple version—the creatures are prettier in there (especially your little green muncher). The graphics on the DOS version are not as great, but the gameplay’s the same and the Troggles still look quite nice in that version. If you want to try the game yourself, the original version is available to the public on the Internet Archive, all for free. Better still, no emulator is required. What’s not to like?

Believe it or not, this is not the only maths-themed game in the Munchers series—there’s another game called Fraction Munchers! It features fractions instead of whole numbers, but I’ve never seen it! If you’ve been lucky enough to have played that game, why not send your review of Fraction Munchers to Chalkdust? It might just become an online article in here, too!


Flo-maps fractograms: the prequel

My original interest in decimal fractions was due to studying the ‘chaotic dropper’ experiment (see Fractograms from Chalkdust issue 02). Long before this, I had read about modelling the growth of a population and finding that it, too, can demonstrate chaotic behaviour. This is shown by using a logistic map. I realised the digits of decimal fractions could be subjected to the same modelling process. Let me explain.

Continue reading


Rewatch the Issue 12 virtual launch event

Have you read through all of Issue 12 and feel lost without Chalkdust in your life? Then you are in luck because to celebrate Issue 12 in all its majesty, we hosted a virtual launch event YouTube livestream!

This featured not 1, not 2, not 4, not π, but 3 interactive workshops by the team behind Issue 12.

We figure out whether poetry is really just random nonsense or not, by creating Markov chain poetry and seeing how it measures up (check out this article for more on Markov chains, and this poem for inspiration).

We make our very own stunning mathematical drawings to colour in, using only a ruler and compass (like the ones on issue 12’s cover)—just the soothing activity you will need to take your mind off the fact that it’s another six months until Issue 13.

And last but certainly not least, we play some Countdown (numbers round, of course), presented by Nick Hewer and Rachel Riley (as soon as they return our calls).

Watch it again at The launch event was live on Saturday 14 November, 2:00-3.30pm GMT.


Read Issue 12 now!

Our latest edition, Issue 12, is available now! Enjoy the articles online or scroll down to view the magazine as a PDF.



Printed versions


Download Issue 12 as a PDF


In conversation with Christina Pagel

This interview was conducted on 11 August 2020, and our discussion of the pandemic reflects this.

Given everything we read in the news during this pandemic, it is no longer a surprise to anyone that maths plays a crucial role in solving problems that affect our daily lives. This has been thrown into the spotlight recently, with mathematical modellers advising government policies across the world and statisticians holding the key to decoding the chaos of pandemic data; but it has been going on behind the scenes for quite some time. Operational research (OR) is the branch of applied maths dedicated to using maths to make better decisions, and it can be applied to almost any field. If that sounds vague, fret not, because we sat down with Christina Pagel, professor of operational research and director of the Clinical Operational Research Unit (CORU) at UCL, and a member of the Independent Sage (Scientific Advisory Group for Emergencies) committee, to clear up exactly what it entails.

“Operational research is a really applied branch of maths, and you can use any kind of maths, as long as you’re answering a real world problem.” But some maths is more typical of operational research than others. For example, queueing theory is the mathematical theory behind modelling queues and making them more efficient, ie deciding who gets served in what order. Another classic of OR is optimisation, which is choosing how to allocate resources given certain constraints and goals, such as minimising costs or maximising profit. “That’s used everywhere from transport, health care, emergencies… The travelling salesman is a really well-known optimisation problem—how do I visit these destinations in the shortest time possible?” Chalkdust would like to apologise to readers for any distress caused by the reminder of their decision maths A-level module.

To save you from digging out your old lecture notes: a Poisson distribution describes events that occur independently at a fixed rate, while an exponential distribution is the probability distribution of the time between Poisson events.

Data analysis is crucial too. “How do we use the data that people have to help them make decisions? That’s a big branch of operational research.” And of course, as with most branches of maths these days, simulations play a big role. “Say in queueing theory, it’s fine as long as you have Poisson arrivals and exponential service times, but once you get to real life and see that actually you have this funky algorithm for choosing who gets served and how long it takes, then you start having to use simulation because you just can’t solve it analytically.”

But the field is very problem-focused, and for Christina the maths is of only secondary interest to the questions themselves. “I’ve become less interested, as I become older and more senior, in the novelty or difficulty of the mathematics and much more interested in the problem.” And it shows—she has worked on more problems than there are maths puns in an issue of Chalkdust.

Paediatrics, politics, periods…

Great Ormond Street hospital, c~1872. Image: Welcome Collection CC BY 4.0

As director of CORU at UCL, Christina focuses on operational research applied to healthcare. She recently held a position as researcher in residence at Great Ormond Street hospital (GOSH), a children’s hospital in London, helping them solve problems like predicting how many beds they will need, or when the children’s respiratory disease peak will be. The peak is about a month and half earlier than the adult flu peak, and Christina built a model for GOSH to let them know when it begins. This is crucial to know because when it comes, “demand will double very quickly and they don’t have more capacity.”

This is only the tip of the iceberg in regards to all the problems healthcare needs mathematicians to solve. Another classic operational research problem that CORU has worked on recently is investigating the ideal placement of the UK’s 11 specialised ambulance services which transport sick children from local hospitals to paediatric intensive care hospitals, as well as the possibility of changing the number of ambulances at each location. “We also do simple models of vaccination programs for the [UK government’s] Department of Health and Social Care. If I’m introducing a new vaccine, what is the impact of other vaccines? How many times do I have to vaccinate? That involves a mixture of theoretical modelling and then data analysis. Sometimes we mix them together, like in queue models for how many health visitors you need to serve a certain community with certain needs, which is something we’re doing right now for instance.”

If you can’t articulate what you’re trying to do, then all of your solutions for getting there are meaningless.

For even further evidence of the infinite set of problems mathematicians are in demand to solve (as if we needed it), Christina tells me she began a fellowship in the US in 2016 to study their healthcare system, but unexpectedly found herself more useful in political science. “Within about two months of me getting there, Trump was elected. And it became really clear that he was going to try to repeal Obamacare. He failed, but I didn’t know that at the time.” She felt there was no point working to improve a health system that was about to be upheaved, but she saw politicians arguing about Obamacare and she realised that she had a unique perspective on how to understand their feuds.

“I thought, ‘Do we understand what the goal is in the situation?’ That’s a classic operational research point of view. If you can’t articulate what you’re trying to do, then all of your solutions for getting there are meaningless.” She devised a survey for politicians to understand what their goal was. The survey had thirteen possible goals that were developed with a focus group of serving politicians and academic health policy experts, such as ‘improve health’, ‘reduce costs’ and ‘reduce inequality’, and participants were asked to rank them on importance. Using a voting system, she was able to give the items an ‘overall’ ranking, and used a stats technique for plotting multidimensional priorities to see how people on different parts of the political spectrum felt about healthcare. “It wasn’t anything particularly sophisticated, but they just hadn’t ever done that!” What was common sense to Christina was a completely new way of looking at the problem to political scientists.

For Christina, applied maths goes far beyond merely applying maths. She’s an interdisciplinary science communicator able to turn her hand to everything from politics to physics to biology. Image: Reproduced with permission from Christina Pagel

The methodology was a triumph in and of itself—perhaps fortunately, since the more challenging task of showing that politicians agreed on the goals didn’t transpire quite as planned. “I thought everyone would say improving health is the most important thing. But actually, improving health was only most important for Democrats, and second most important was reducing inequalities and improving access to healthcare. Whereas, for Republicans, the most important thing was reducing costs, and the second most important thing was reducing the involvement of government in healthcare, which to me was really bizarre, but that was important for them. Improving health came fifth out of thirteen, and last was reducing inequality.” But even though they could not agree, the survey still clarified exactly why they couldn’t agree. “It’s really helped them understand how they can talk to each other. For instance, if you’re a Democrat, and you want to push a policy because it reduces inequality, to your Republican colleagues that’s not the angle you use, you have to explain how it reduces costs.”

She is now working on a project looking at women’s period pain. “It’s not really my expertise, but if no one else is going to do it, then I’ll do it.” She is working with the Health Foundation to look at GP records to quantify the problem, which she hopes will convince medical researchers to give the issue serious attention. “80% of women at some point in their lives suffer from really bad period pain, and about 20% have some years of their life where actually it’s debilitating for two or three days a month. People have just found a way to live with it, when you shouldn’t have to live with that—why should you have to live with that? So we’re now trying to take it further and make it into a bigger project.” Picking up a problem wherever she sees one to solve is rather a habit of hers it seems. Of course, healthcare has had one particularly big problem to solve recently.

…and pandemics

Well, we had to talk about it eventually.

Operational research has played a crucial role in managing the pandemic from the beginning, and Christina laments that even better use of it has not been made. “There are loads of places operational research could have helped [the UK government] to do better.” An obvious issue is distribution of PPE (personal protective equipment), but there are many examples. “For instance, 30% of people with Covid-19 in intensive care units (ICUs) had kidney failure, so the whole country ran short of renal medicine, and that had knock on effects on people receiving dialysis.” When medicine is in short supply like that, how should it be distributed and prioritised? “How do you decide how many ICU beds you need when you’re reorganising hospitals? How do you decide how many emergency hospitals you need, like the Nightingales? All of that is OR. Even things like oxygen supply—Covid leaves so many people on supplemental oxygen that hospitals were running short, so how do you manage that? Because if you run out, then everyone in the hospital who needs oxygen is screwed which you obviously don’t want.”

Christina has been playing her part as a member of Independent Sage—or, as she affectionately calls it, “indie Sage”—a group of scientists who produce independent advice on the UK’s handling of the pandemic, to challenge and analyse that given by the government’s official scientific advisory group, Sage. Although initially she was expecting to be doing operational research, it became more a public communication of science role. It turns out this is something she excels at. “Because I’ve been working across disciplines—clinicians, patients, people in the government, local commissioners—I’ve had to always try to explain things to lots of different types of people. That’s been really helpful in indie Sage, in that I’m not in a silo.” She now does weekly YouTube briefings (on the indie_SAGE channel) breaking down where we are at with the pandemic and collating government data from countries around the world, and reasonably regularly appears on TV and radio explaining the latest numbers.

I’ve been working across disciplines—clinicians, patients, people in the government, local commissioners—I’ve had to always try to explain things to lots of different types of people.

Independent Sage believes the UK government should be aiming to achieve elimination of Covid. “There’s a technical difference between elimination and eradication. Eradication is what we’re trying to do to polio and what we did to smallpox, but elimination is what New Zealand did, which is zero community transmission.” This would mean the virus can only enter the country via travellers, which Christina says could hopefully be handled with effective test and trace, and quarantine. “And once you’ve done that, you can go back to normal life! Masks, social distancing, you don’t have to worry about that stuff.” Critics of the strategy say it is simply unachievable. “But it’s not saying you’re never going to get a case. Small outbreaks are much easier to stamp down. It’s like in my house, I have a zero fire policy, I’m not going to let any fire come out, and if it does I’ll put a tea towel over it. We’re stuck in this limbo where you can open mostly but not completely, and if you relax when you haven’t got it down far enough it goes out of control. We’re saying get it down far enough, and you do that through really, really good contact tracing. You have to break the chain of transmission, that’s what South Korea did, that’s what China did.” Unfortunately, between speaking with Christina and writing this article, it’s starting to seem like this prediction may be coming true.

Elimination… is zero community transmission… and once you’ve done that, you can go back to normal life! Masks, social distancing, you don’t have to worry about that stuff.

So what does she think the UK should have done to get to such low levels of Covid? “You close down the areas that are really risky. We know outside is safe, but indoor pubs… it’s not a good idea. When countries opened shops, nothing really happened, but when they opened pubs, a few weeks later cases went up. Pubs, restaurants, bars, household parties… all of that causes superspreading events.”

If we had put on more restrictions in the short term while cases were still low, Christina believes we could, in a matter of weeks, have been able to achieve low enough levels to try to eliminate Covid and then we would be in a much better position to reopen schools and have students return to university. The returning of students to university poses a particular concern. “Younger people are much less likely to get symptoms, so they may get Covid and have no idea. And if we don’t have a really good contact tracing system, you can’t stop that. Whereas a really good contact tracing system stops people without symptoms going out, that’s how it works.” To clarify, she doesn’t believe the problem was opening up too early, but rather too quickly. “We opened up schools, and then two weeks later we opened shops, and two weeks later bars, and then gyms and then workplaces. But actually every time you open something, you need to give it about four weeks before you see anything in the data.” More patience with easing restrictions could have avoided the need for local lockdowns. “Local lockdowns are very damaging, whereas if they just waited and got to very low levels of Covid, it would have been fine.”

Master of all trades

Hearing how multi-disciplinary her current job is, perhaps it should not be a surprise that Christina has dipped her toes in quite a few fields before settling on maths, and has four master’s degrees to show for it. “I did maths as an undergrad, because I wanted to be a physicist, which made perfect sense at the time. And I thought quantum mechanics was awesome, so my first master’s was in quantum theory.” But when it came to choosing a PhD, she was told she would have to do a topic that was very heavy on tensors, and she understandably ran for the hills. “I thought, ‘I’m out then, it’s not for me!’ So I got a job and decided to do a part-time MA in classics because I always loved history, I loved ancient history, I loved Latin. I chose maths for my degree because you can’t skip from doing maths A-level to doing a master’s in maths, but you can do that in humanities.” Even though supposedly she needed an arts degree, she was admitted to the MA in classics with a first in maths, simply because people find maths impressive. “People will just give you the benefit of the doubt, it’s actually really handy.” She really enjoyed the opportunity to learn purely for pleasure.

I did a PhD in space physics, because I thought… ‘I want to be an astronaut.’

Eventually, physics called her back. “I did a PhD in space physics, because I thought… ‘I want to be an astronaut.’” Again, they were more than happy to accept a student with a background in maths. But she found herself frustrated with the obscurity of her work. “No one would have cared if I got it wrong. Literally, there were ten people in the world interested in that area of physics.” This is what inspired her to go into research that had a very direct application. “I thought this practical use of maths to help concrete problems is really appealing, so then I came to CORU.”

Although she had found her new calling, she couldn’t bring herself to give up her other passions yet. “I did another part-time master’s in medieval history, and again I really loved it.” The final master’s, which she did later in her career, was in statistics. “That was because people in health think if you do maths, then you’re a statistician. So I thought I’ll just do a stats qualification so I can say I am! But it wasn’t nearly as fun.” However, she did enjoy having her talents in maths reaffirmed. “I spend most of my time now doing project management, so it was kind of nice to do maths again and realise I could still do it.”

It is certainly good to hear that mathematicians have this power to jump around to any field they want. “The earlier you switch, the easier it is. For me, I looked at people who were working at CORU at the time, and about half the unit had done undergrads in physics, so I knew it was fine. We advertise that we don’t mind if people come with a different background. Maths teaches you how to think, and it is really flexible. You can’t change field and expect everything to stay the same. You have to be willing to learn a new programming language, a completely different way of looking at things. Operational research suits people who aren’t wedded to methods, or a certain type of way of doing things, but are actually really interested in real problems.” It may be a relief to anyone choosing modules or PhD topics that their choice won’t limit their career options—and in fact, as our conversation comes to a close, she has some advice for people making these decisions now. “If you’re thinking about doing a PhD, it does matter who your supervisor is. It’s quite an intense relationship, they’re the person who is going to be guiding you into becoming an independent scientist, and having someone who doesn’t want to do it or who is not that engaged can just be a really bad experience. And you have to find it interesting—because you’re going to be doing it for three years, and that’s a long time!”