A faster way to calculate the day of the week
197 points - last Sunday at 9:20 PM
SourceComments
1) Western gregorian calendar (doing business with foreigners, international travel, banking, finance, most everything done on the Internet, etc).
2) Islamic arabic originated lunar calendar (When does Ramadan start, when is an okay time to go for hajj, when is Eid Al-Fitr, when is Eid Al-Adha, etc). This goes "backwards" 10 to 11 days per year compared to the western gregorian calendar so in different decades Ramadan might be in the middle of summer, or middle of winter.
3) Persian solar calendar for new year observances like Nowruz: https://en.wikipedia.org/wiki/Nowruz , and generally persian-related cultural things: https://en.wikipedia.org/wiki/Solar_Hijri_calendar
But wait, there's more! Let's say you live in Uzbekistan or Tajikistan or that region and you do business with Russians. You might have to think about when the Russians are on vacation and businesses are closed, because they're taking holidays and religious observances based on the eastern orthodox calendar. Basically all the same problem as trying to get business things done in the UK on a UK standard "Bank Holdiay". Their Christmas is not the same as the western Gregorian calendar Christmas...
https://en.wikipedia.org/wiki/Eastern_Orthodox_liturgical_ca...
The trick is to notice that in any year, leap year or not, the following dates will be the same day of the week in any year: 4/4, 6/6, 8/8, 10/10, and 12/12. (Whether you use the month/day style favored in America, or the day/month style that the rest of the world uses, either way those dates are the same, which is convenient). Which day of the week those dates are will vary from year to year: this year (2026) those are all Saturdays, last year they were all Fridays, next year they will all be Sundays. But in any given year, those dates are separated by 63 days, a multiple of seven, so they are always going to be the same day of the week.
And that's not all: look at 5/9, 9/5, 7/11, and 11/7 — those are also that same day of the week! (Again, conveniently, this works whether you're using the American calendar style or the rest of the world). Those odd-numbered dates can easily be remembered with the mnemonic phrase "a 9-to-5 job at 7-11". And voila, you have memorized one "special" day in nine of the twelve months. (What you do for January, February, and March I will cover later).
Now I'll pause and explain why this is useful. Many of you have already made the intuitive leap to figure this out, but it's still useful to see it spelled out. If you're trying to figure out what day of the week a certain date, let's say August 31st, is going to be, then you find the "key" date for that month (August 8th), and remember that this year, those key dates are Saturdays. (I don't yet have a good mnemonic for easily remembering which key date is which for each year; I'd welcome suggestions if you can think of one). So, 8/8 was a Saturday. Therefore, August 15th and 22nd and 29th are Saturdays. Therefore, August 31st will be a Monday this year. All of that is math you can easily do in your head in seconds.
Now, January, February, and March. March is always the same in every year: March 7th. 14th, 21st, and 28th are the "key days" that are the same day as 4/4 et al. But the way I prefer to memorize March is that "March 0th" (which isn't actually in March, it's the last day of February) is the "key day". That still lets me do the mental math for March easily enough, but it also reminds me that Feburary 28th or 29th, depending on whether you're in a leap year, is the "key day" for this year. Finally, for January, I use January 3rd in non-leap-years and January 4th in leap years as the "key day" that I memorize; the number 4 is strongly associated with leap years, so "leap year = January 4th" is easy to memorize, and I just have to remember that it's one day less in non-leap-years, January 3rd.
And so I just have to memorize "January 3rd or 4th" and "March 0th", plus the phrase "a 9-to-5 job at 7-11". And I can easily figure out in my head what day of the week any day of the year will be. For example, December 25th will be a Friday this year: that took me three seconds to work out in my head without looking at a calendar.
Below the surface it's all the division with constant trick.
If only they were in resonance.
else output = :(