What Day Is It?
By Matt Baker - Wednesday, March 10, 2021
This post will be rather different from the others in the Mathemagical Themas series, as on the surface it’s a mental stunt rather than a magic trick: I’ll be teaching you how to calculate the day of the week on which any date falls. But while I typically use this as a demonstration of skill, I also sometimes use it in a more subtle way to enhance my magic performances.
For example, one way in which I’ve used this in the context of a close-up performance is to have a participant tell me the name of a friend or family member whose birthday they know. I then have the participant write down the person’s birthday (month, day, and year) on the back of a business card, which is placed sight unseen into a wallet (ostensibly to enable verification later on). I then do a “reading”, which might go something like this:
“Sally Johnson. With a name like that, I bet she’s a Virgo. Is this your mother? Oh, it’s your aunt. Is she still alive? Does she have a favorite food? Lasagna, interesting… so she must have been born on a Saturday. Is that right? Oh, you’re not sure… well, that’s OK, we can Google it later. Anyway, concentrate on the year in which she was born… since it’s your aunt, I’m going to say early 1940’s, probably ’41 or ’42. Is that right? And since she’s a Virgo, that means she was born in either August or September – I’m gonna go with August. Alright, I’ll go out on a limb and take a stab at her exact birthdate… was it August 28th, 1942? No, wait, that would have been a Friday, but I said it was a Saturday… so it must have been August 29th.”
After the spectator finishes freaking out, I casually take out the business card and hand it back to her, and almost as an afterthought I add, “Oh, and we said we’d confirm that it was a Saturday… take out your phone and Google ‘Day of the Week for August 29, 1942’. What does it say?” The spectator finds that it was indeed a Saturday.
The point I want to emphasize is including the day of the week in your ‘reading’ adds an additional layer of impossibility to the effect, since the day of the week was never written down (and the participant usually doesn’t know the day of the week themselves). Don’t think that this detail goes unnoticed. People are not stupid – they know that if they write something down and later on a magician divines it, the magician must have somehow seen what was written, even if this doesn’t seem possible. Adding the extra “day of the week” layer runs an interference patter on this kind of analytical backtracking.
There are three parts to the method. First – and I’ve already alluded to this – I peek the birthdate (I personally use Mark Strivings’ Sight Unseen Case). Second, I know the astrological sign corresponding to each birthdate (if it’s a borderline date like April 20th and I’m not quite sure, I’ll just say it’s either Aries or Taurus and move on). Finally, and this is the part I’ll explain in detail below, I mentally calculate the day of the week on which the date falls. There are several methods for doing this; the method I’ll teach now is something I learned from the book Mathematical Magic by William Simon more than 30 years ago.
Modular Arithmetic
A basic prerequisite for being able to do the required calculations is a rudimentary knowledge of modular arithmetic. When we do arithmetic “modulo N”, it means that we are allowed to add or subtract multiples of N at will without changing the answer. For example, arithmetic modulo 12 is often called clock arithmetic: 13 o’clock is the same as 1 o’clock, so 13 and 1 are “congruent modulo 12”. Similarly, when we work modulo 12, 5 is congruent to 17, which is also congruent to 29. We can also go backwards: for example, by subtracting 12 we see that 5 is congruent to –7. (This should make intuitive sense: if it’s currently 12 o’clock then in 5 hours it will be 5 o’clock and 7 hours ago it was also 5 o’clock.)
For calendar calculations, we need to work modulo 7 (because there are 7 days of the week). Modulo 7 we can say that that 37 is congruent to 2, since 35 is a multiple of 7 and 37 - 35 = 2. (Another way to think of this is that 2 is the remainder when we divide 37 by 7.)
One of the great things about modular arithmetic is that you can simplify along the way. For example, to compute 4 + 8 + 11 modulo 7, you can calculate 4 + 8 = 12 = 5 (modulo 7) and then add 11 to get 5 + 11 = 16 = 2 (modulo 7). Or you could immediately recognize that 11 = 4 (modulo 7) and instead of adding 11, just add 4 to get 5 + 4 = 9 = 2 (modulo 7).
Encoding the days of the week
We will use the following numerical encoding of the days of the week:
- Sunday = 0
- Monday = 1
- Tuesday = 2
- Wednesday = 3
- Thursday = 4
- Friday = 5
- Saturday = 6
It’s best to memorize this correspondence, not just have the ability to figure it out. The mathematician John Conway (who developed his own original method for calculating the day of the week, which he called the Doomsday Algorithm) suggested, as a mnemonic device, thinking of the days of the week as "Noneday", "Oneday", "Twosday", "Treblesday", "Foursday", "Fiveday", and "Six-a-day".
Also, in the calculations which follow, it’s best to think of these numerical values as being defined modulo 7. So, for example, 3 days after Saturday is a Tuesday, and 6 (Saturday) + 3 is equivalent to 2 (Tuesday) modulo 7.
Year Code
If we write the year in question as CCYY, the last 2 digits YY will determine a Year Code and the first 2 digits CC will determine a Century Adjustment. The year code is the most complicated of all the calculations we need to do, so we may as well begin by tackling it head-on.
To find the year code, we first calculate the number of times 4 goes into YY, throwing out any remainder. We then add this result to YY and take the result modulo 7; this gives the year code.
For example, if the year is 1963 then CC = 19 and YY = 63. We calculate:
- 63 divided by 4 is 15 with a remainder of 3 (we ignore the remainder).
- 63 + 15 = 78.
- 78 is congruent to 1 modulo 7, so the year code is 1.
Century Adjustment
If the date is in the 20th century (i.e., CC=19), subtract 1 from the year code. If the date is in the 21st century (i.e., CC=20), subtract 2. (For other centuries, see Remark 3 below.) These adjustments are done modulo 7, of course, so if you need to subtract 2 from 1 the answer is 6 (since 1 – 2 = –1 = 6 modulo 7).
Example 1: 1963
- Year code = 63 + 15 = 78 (= 1 modulo 7)
- Century adjustment = –1
- Century-adjusted year code = 1 – 1 = 0
Example 2: 2016
- Year code = 16 + 4 = 20 (= 6 modulo 7)
- Century adjustment = –2
- Century-adjusted year code = 6 – 2 = 4
Month Code
Each month has a month code, given as follows:
Month |
Month Code |
January |
1* |
February |
4* |
March |
4 |
April |
0 |
May |
2 |
June |
5 |
July |
0 |
August |
3 |
September |
6 |
October |
1 |
November |
4 |
December |
6 |
The asterisks are there because if the year in question is a leap year, we need to subtract 1 from the month code in January or February.
A good mnemonic for the month codes is that, reading down the list, we have the sequences 144, 025, 036, 146. The first three of these (144, 025, 036) are perfect squares (and the last triad consists of the first 2 digits and the last digit of the previous 9 numbers).
However, if you want to get really fast with this system, you’ll need to be able to immediately recall the month code given a month without just “going down the list”. I myself simply memorized the month codes through repetition and drilling, but if you prefer mnemonics, see the end of this post.
Day of the Week = Month code + Day + Year Code + Century Adjustment (modulo 7).
Example 1: April 14, 1963
Month code = 0
Day = 14 (= 0 modulo 7)
Century-adjusted year code = 0
Day of the week = 0 + 0 + 0 = 0 modulo 7 (Sunday)
Example 2: February 25, 2016
Month code = 4 – 1 = 3 (–1 for the leap year adjustment)
Day = 25 (= 4 modulo 7)
Century-adjusted year code = 4
Day of the week = 3 + 4 + 4 = 11 = 4 modulo 7 (Thursday)
If you learn the basic method and then incorporate some of the speed-up tips given below, you’ll find that with practice you can calculate the day of the week for any given date quite rapidly. There is a helpful smart phone app which you can use to test yourself and run regular drills.
I find the ability to calculate the day of the week given any date pretty handy in every day life. For this, I simply memorize the century-adjusted year code for the current year and this makes the whole calculation super-fast. The century-adjusted year code for 2021 is 3, so if someone tells me that Magifest 2021 starts on September 16th, then just by calculating 6 + 16 + 3 = 4 modulo 7 I know that I need to take off work starting on a Thursday. No cumbersome year code calculations needed in this context…
If you want to be able to handle centuries other than the 20th and 21st, here’s a table which shows you how to do it:
CC (mod 4) |
Century Adjustment |
1 |
3 |
2 |
1 |
3 |
-1 |
4 |
-2 |
For additional tips, techniques, and references, see this post.
Some of you might have other ideas for how to use the ability to calculate the day of the week in the context of a magic performance – please post them in the comments section below!
Postscript: Mental Shortcuts and Mnemonics
As with learning to quickly solve a Rubik’s cube, the best way (in addition to frequent practice and repetition) to improve one’s ability to quickly perform mental calendar calculations is to learn additional shortcuts. Here are a few you might find helpful:
Here’s a way to speed up the calculation of the year code. Within any given century, the Gregorian calendar repeats every 28 years. This means that we can subtract multiples of 28 from YY (as long as it doesn’t yield a negative answer) and the result will be the same. To do this quickly, I find the following rules useful:
- To subtract 28, subtract 30 and then add 2.
- To subtract 56, subtract 60 and then add 4.
- To subtract 84, subtract 90 and then add 6.
So another way to calculate the year code for 1963 would be to do the following:
- YY=63.
- 63 – 60 + 4 = 7. (We’ve just subtracted 56, which is a multiple of 28, from 63.)
- 7 divided by 4 is 1 with a remainder of 3 (ignore the remainder).
- 7 + 1 = 8.
- 8 is congruent to 1 modulo 7, so the year code is 1.
One can also avoid excessive calculations by memorizing the year code for a number of target years and then just working backward or forward from these. For example, suppose you have memorized the following two lists:
Year Code 0: 00, 06, 17, 23
Year Code 3: 03, 08, 14, 25
You can now get to any year by first subtracting multiples of 28 from YY to get into the range 00 through 27, and then count up or down from one of the reference years (taking leap years into account as appropriate).
For example:
- YY = 78: 78 – 60 + 4 = 22, which is one less than 23, so the year code is 0 – 1 = 6.
- YY = 52: 52 – 30 + 2 = 24, which is 1 more than 23. Since years ending with 24 are leap years, we have to add 2 (not 1) to get the year code for YY = 24 from that of 23. So the year code is 0 + 2 = 2.
- YY = 94: 94 – 90 + 6 = 10, which is 2 more than 08. Since we don’t move through any leap years when going from 08 to 10, we add 2 to the year code for 08 to get a year code of 3 + 2 = 5 for 94.
Finally, for readers who would like mnemonics for the month codes, here are some that I came up with specifically for the purposes of teaching this method:
- January = 1 (1st month of the year)
- February = 4 (“Fourbruary”)
- March = 4 (There are 4 March sisters in “Little Women”)
- April = 0 (Fools know nothing)
- May = 2 (“Mayday” has two syllables)
- June = 5 (June’s birth stone is PEARL, which has 5 letters)
- July = 0 (America turned 0 in the month of July)
- August = 3 (Augustus Caesar was part of a triumvirate)
- September = 6 (September=Six)
- October = 1 (October=One)
- November = 4 (NOVA has 4 letters)
- December = 6 (Christmas is 6 days from the end of the year)
Back to blog homepage
Similar posts on the blog: