An old nursery rhyme begins “Monday’s child is fair of face / Tuesday’s child is full of grace”. Perhaps character and personality were determined by the weekday of birth. More likely, the rhyme was to help children learn the days of the week. But how can we determine the day on which we were born without the aid of computers or calendars? Is there an algorithm – a recipe or rule – giving the answer? [TM201 or search for “thatsmaths” at irishtimes.com].

The English mathematician John Horton Conway, stricken down by Covid last April, was extraordinarily inventive. He conceived some of the most original and ingenious ideas, contributing to several branches of mathematics.

In 1973, Conway developed a scheme he called the Doomsday Rule, to determine the weekday for any given date. Conway was inspired by Lewis Carroll, author of the Alice books, who had devised a perpetual calendar, but Conway’s method went far beyond Carroll’s in power and versatility.

The Doomsday algorithm involves only simple arithmetic, although it is too intricate to describe in detail here. It also requires the user to learn some rules and to practice the technique so as to produce an answer rapidly.

Conway himself programmed his computer to generate ten dates at random; he had to convert them to weekdays before he could log on to the machine. He became so skilful that he could give the weekdays for the ten dates in about fifteen seconds.

**Clock and Calendar Arithmetic**

The calculation of weekdays involves modular arithmetic. We use modular arithmetic all the time without realizing it: times are given on a twelve-hour clock so, to find the time seven hours after ten o’clock, we add 7 to 10 and automatically subtract 12 to get five o’clock. The numbers ‘wrap around’ at midday and midnight. In math-speak, 17 is congruent to 5 modulo 12. In a similar way, since the days continually cycle through the seven weekdays, we use modulo 7 arithmetic when we say that Tuesday is 5 days after Thursday.

To give a flavour of the Doomsday algorithm, let’s consider a special case: for any given year, on what weekday does Christmas Day fall. All that is required is to remember the day-numbers corresponding to the seven days of the week. Then four easy calculations yield a number giving the required weekday.

The day-numbers from Sunday through to Saturday are recalled without effort using the mnemonic: *Noneday, Oneday, Twosday, Treblesday, Foursday, Fiveday, Sixaday.* Thus, 0 is the number for Sunday, 1 for Monday, and so on to 6 for Saturday. You can append Sevenday for Sunday if you like, since 7 is congruent to 0 modulo 7.

Here are the four simple steps to get the day-number, given any year of the twenty-first century. Step 1: Subtract 2000 from the year. Step 2: Add a quarter to the result (neglecting fractions). Step 3: Divide by 7. Step 4: Add 1 to the remainder. The result is the day-number for Christmas Day.

A specific example will clarify the process. Suppose you are asked for the weekday of Christmas Day in the year 2050. (1) Subtracting 2000 you get 50; (2) adding one quarter (no fractions) you get 62; (3) Dividing by 7 gives remainder 6. (4) Adding one, you get 7, which is equal to 0 modulo 7. Thus, the day number is 0, corresponding to Sunday.

The method outlined works for any day this century. For dates in the twentieth century, we subtract 1900 in step 1 and add 2 instead of 1 in step 4. Thus, Christmas Day in 1950 was on a Monday.

The full Doomsday algorithm is well described on Wikipedia. With some practice and a minimum of mental arithmetic, you can amaze your family after Christmas dinner. Given their date of birth, you can tell, within a few seconds, the weekday on which they were born, and whether they are fair of face, full of grace, or whatever.

**Sources**

Siobhan Roberts, 2015: *Genius at Play: the Curious Mind of John Horton Conway.* Bloomsbury Publishing. ISBN: 978-1-6204-0593-2.

*That’s Maths II: A Ton of Wonders*

by Peter Lynch has just appeared.

Full details and links to suppliers at

http://logicpress.ie/2020-3/