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 a recipe or rule – an algorithm – giving the answer?
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 10 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 10 dates in about 15 seconds.
The calculation of weekdays involves modular arithmetic, something we use all the time without realising it: times are given on a 12-hour clock so, to find the time seven hours after 10 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 weekdays continually cycle, we use modulo 7 arithmetic when we say that Tuesday is five 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.
Four simple steps
Here are the four simple steps to get the day-number, given any year of the 21st 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 20th 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 amuse 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.
A collection of That's Maths articles, That's Maths II: A Ton of Wonders, has just been published. Seehttp://logicpress.ie/2020-3/
Peter Lynch is emeritus professor at UCD School of Mathematics & Statistics – he blogs at thatsmaths.com