Cookies, clocks and soldiers: modular arithmetic!

By on 11/01/2017

Hello everyone!

I belong to MathIsInTheAir‘s Staff and this is my first post as Editor in this amazing website.

MathIsInTheAir is an italian blog of Applied Maths and surroundings and here are the links: english version and italian version. Although our english blog contains not so many posts, we would like to expand it in the very near future.
I don’t want you to get bored, so if you like you may visit our websites or you may read the “not so quick introduction” to MathIsInTheAir I did last year.

Today I just want to present our first english mathematical post, called “Cookies, clocks and soldiers: modular arithmetic!” written by me (Francesco Bonesi). The post starts with a simple and intuitive mathematical problem and goes throughout the solution. The maths behind is quite simple and can be understood by everyone! In the following I will put the beginning of the post and the redirecting links to original italian and english posts.

Hope you like it!

by MathIsInTheAir



Cookies, clocks and soldiers: modular arithmetic!

Introduction and the 7 dwarfs

It was October when one of my professors entered in the lesson room and said: “Once upon a time, Snow White wished to prepare cookies for the seven dwarfs. Obviously…with some conditions. She wanted to prepare the least number of cookies such that dividing them into 2 dwarfs there would remain only one, dividing them into 3 dwarfs there would remain only one and so on for 4,5 and 6 dwarfs but…dividing them into all the 7 dwarfs, there would not remain any cookie.” This problem generated, of course, hilarity and some puzzled faces appeared in the room because of the nonsense of the story and because of the absurdity of the question. It was one of the first lessons during my first year at University and I honestly remained astonished.

Since for the moment it is not very important, we’re not going to talk of Snow White’s OCD but we will focus on the mathematical side of the story. What the professor wants is the smaller positive integer number (a number of the set 0,1,2,…) such that, if you divide it by 2,3,4,5 and 6, you get 1 as remainder and, if you divide it by 7, the remainder is 0.

It seems to be only an hard calculation and of course it is! But, behind this story, there’s some beautiful maths waiting to be discovered. It is called Modular Arithmetic. The good thing is that everyone can understand it…well…maybe it is better to say that everyone already knows it! The answer is in the clock.


The clock

Everyone knows what a clock is. If now it’s 9 a.m. and someone tells that you have a meeting in 2 hours, you’ll immediately understand that your meeting is at 11 a.m.. That’s right! And the reason si that 9+2=11. But, if someone tells that your meeting is in 4 hours, you’ll immediately understand that your meeting is at 1 p.m.. However, 9+4=13, not 1. This seems funny but it’s not!

What are we doing? We are restricting our number set! We are not deleting useless numbers but only collecting them into groups of numbers. So, some of them will coincide, as 13 and 1 for example. This relation is called congruence.

So, for examples with small numbers it’s easy, but for ones with big numbers? If now it’s 5, in 1000000 hours, what time is it?

Here’s the problem…this is not so intuitive…so? No problem, Maths is coming to save us!

…Continue reading our post:

English version: here

Italian version: here

About Francesco Bonesi

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.