A nifty math trick.
Have you ever wondered what day of the week your birthday will fall on next year, or tried to make holiday plans without knowing whether Christmas will fall on a weekday or weekend? There are some simple math tricks you can use to figure it out.
First, if you’re near a computer, don’t make your life more complicated than it needs to be. Plug the date into Google and it will spit out the day of the week.
But in a Mind Your Decisions video, Presh Talwalkar explains how you can do it mentally using something called the Doomsday rule. Particular dates throughout the year (known as Doomsday dates) always fall on the same day of the week as each other — a date we can calculate for any year until 2099 — and you can use that knowledge to figure out when other dates will take place each year.
Some of these dates are:
December 12 (12/12)
November 7 (11/7)
The first set is easy to remember because they are pairs of even numbers. Talwalkar suggests that you remember the second set using the mnemonic “I work 9 to 5 at the 7-11.”
A few more are: Pi Day (3/14), the last day of February (2/28 or 2/29) and January 3 (1/3) or January 4 (1/4) if it’s a leap year.
So, say we want to know when Christmas Eve of 2020 will be, if we know that Doomsday in 2020 falls on a Saturday (we’ll see how to calculate that in a moment), we can look for the closest date on our list to December 24 — December 12 — and calculate from there. December 26 will be a Saturday since it is two weeks from December 12, so Christmas Eve must be a Thursday.
But how can we know when Doomsday will be in the first place? All of the other calculations depend on that.
There’s a formula that we can use that calculates a one-digit code that represents a day of the week for New Year’s Day, with Sunday starting at 0 and Saturday ending at 6.
Code = (-1 + YY +⎡YY/4⎤) mod 7
If you’re not familiar with all of the symbols in that formula, that’s ok. They’re actually pretty simple. The weird brackets “⎡⎤” just mean “rounded up” and the “mod 7” stands for modulo 7 and means “divide by 7 and keep just the remainder.”
Let’s try it out for 2021:
Code = 5
So New Year's day falls on a Friday. Doomsday will be January 3 since it isn’t a leap year, so we just have to count forward two days from Friday, which gives us Sunday.
Now it’s time to impress your friends! Not only will this work going forward until 2099, but you can also use it backwards to 2001.
Read next: How to Fairly Cut a Cake, According to Math