Calculate the day of the week for any date in your head
rudy.ca
rudy.ca
If the last two digits of the year are 00, throw them away and keep only the first two digits. Otherwise, keep only the last two digits. The year is a leap year if what you kept is divisible by 4.
Examples:
- The year 1705 does not end in 00, so throw away 17 and keep 05. 05 is not divisible by 4, so 1705 is not a leap year.
- The year 2000 ends in 00, so throw away 00 and keep 20. 20 is divisible by 4, so 2000 is a leap year.
The standard method [2] is more complicated:
> Years that are divisible by four are leap years, with the exception of years that are divisible by 100, which are not leap years, and with the final exception of years divisible by 400, which are.
[1] https://twitter.com/jordancurve/status/1012203999716618240
[2] https://www.theguardian.com/science/2011/feb/28/leap-year-al...
In what way do you believe that I am fooling myself?
It seems to me we go through life with little exceptional circumstances all the time, and go right back to normal pretty easily.
Is it that hard to imagine having a holiday not disrupting the weekly rhythm of your life? For example, there's a group I go to every Wednesday. But since Christmas and New Year's are both Wednesdays, it's being skipped two weeks in a row. On the other hand, if Christmas and New Year's "didn't count" then we could carry on without changing the schedule, getting in the way of other standing plans, etc.
But go ahead, make this about how narrow-minded my view on life is. Arguments like this are why wishy-washy calendar ideas like the one being proposed got blown to bits and relegated to a single page wikipedia article barely worth the occasional mention.
This would make the days of the week always cycle synchronously with the days of the month.
Then you have one day left over for New Years and that extra Leap Day every 4 years that your linked calendar proposes.
If you are going to redo something like a calendar, ending up still having different length months and weeks that drift against them seems like a non-victory.
It's also so obvious. Not sure how I missed it. I'm stealing the idea. It shall be named whiddershins' calendar.
12 is what we already have. So nothing would have to change in that regard. We could keep the names as they are, despite the fact they are out of order as it is.
I used to think the same way, but after seeing this calendar, it would be easier to integrate this into what we currently have, just the amount of days have changed.
And, this calendar would work well with businesses. Most businesses are based on quarters. Not that it is significantly more difficult to track 13 weeks (they would be static after all), the pushback would be less, arguably.
And the world calendar is cyclical, just on a quarterly scale, rather than a monthly scale. I'd argue the monthly cycle makes more sense. But the math of the Earth's rotation doesn't make for a nice calendar.
I feel the world calendar would be easier to integrate, and a little nicer (I am a huge advocate for base 12 anyway, that's always been a big hangup for me for the international fixed calendar).
Do Americans, for example, feel like "a new week has started" on Sunday morning? For me Saturday and Sunday feel as one block, it's weird to imagine a separation in there.
But perhaps someone who grows up with that calendar feels like Saturday is end-of-the-week winding down, and Sunday is a start-of-the-fresh-week "warmup" day.
The point is that specific religious leaders would oppose it because it would stop them from controlling the population. I doubt there are religious zealots in this age and era.
It also still requires a lookup to bootstrap it: the day-of-week of the last day of February for the selected year. So it's a clever and well-observed compilation of identified patterns, but not self-contained.
You can get from the year to the doomsday by a simpler formula:
If odd, add 11; divide by 2; if odd, add 11. Count up to nearest multiple of 7
So e.g. 1955 turns into 66 turns into 33 turns into 44 turns into 5. Add that to 4 for the century (1900 is 4, 2000 is 3, that's all you really need to memorize) and you get 9, so the doomsday for 1955 is Monday.
From there it's simple, 4/4 6/6 8/8 10/10 12/12, 9/5 7/11 per the mnemonic mentioned, last day of February, Jan 3/4 depending on leap year, and March 7 counting forward from February.
There, that's the entire algorithm.
For years other than the centuries, we need to add an offset. Given the year CCXX, we have:
(a, b) = divmod(XX, 12)
c = b // 4
offset = a + b + c
doomsday = start + offset
E.g., for 2020 (XX == 20) we get: start = 2 # from the "2053" rule
(a, b) = divmod(20, 12) # (1, 8)
c = b // 4 # 2
offset = 1 + 8 + 2 = 4 (mod 7)
doomsday = start + offset # 2 + 4 = 6 = saturdayWith both divide by 12 and odd 11, I would find myself occasionally making a goof when dealing with years near the end of centuries.
It is. I remember this being one of my programming assignments in college. Another one is determining whether a year is a leap year.
Savants who do this are called "human calendars".
I reckon it's memory related, he has an incredible memory and can tell you everything he did on a specific day in the past!
Maybe at some point he just scanned the Windows calendar or something!? We (and his teachers) can't work it out.
(There’s also a earn-by-example page: http://firstsundaydoomsday.blogspot.com/2011/01/learn-by-exa...)
Using Sundays rather than doomsdays simplifies the arithmetic. Another improvement the above approach incorporates is the odd+11 rule for calculating the year code.
- For 2020, the doomsday is Saturday.
All the dates below are doomsdays (So this year they are all Saturdays):
- 4/4, 6/6, 8/8, 10/10, 12/12, easy enough
- 9/5, 5/9, 7/11, 11/7 (9-to-5 at 7-11)
- 0th of March (last day of February)
- 3rd of January for non-leap years, and 4th of January for leap years. So this year the 4th is Saturday.
And to calculate dates: mod 7.
So e.g. 7th of July: it's is 4 days before Saturday 7/11, so it's a Tuesday.
Last year Pi Day was Thursday, this year Saturday.
So the general rule then is: March 14th, April 4th, May 9th, June 6th, July 11th, August 8th, September 5th, October 10th, November 7th, December 12th, January 2nd, February 6th are Pi Days.
Edit: another nice rule is that usually Pi-Days increase by 1 each year (2 in leap years), so next year it will be Sunday, then Monday, Tuesday, Thursday (leap year), Friday, etc.
As for calling it Doomsday, well, it's from the title of the paper about the algorithm, by the man who invented it, the famous John Conway: https://en.wikipedia.org/wiki/Doomsday_rule
Except my wife number, which I should learn. But I know how to say if a month is 30 or 31 days by counting my knuckles.
These are the kind of "hardly important but easy to remember tricks" I like
At some point in my life, all of these seemed needlessly complex and arbitrary to me, but they don't anymore (at least unless I think too hard about them). I don't think about them unless I have to teach them to someone else, at which point I start thinking about how seriously broken they are.
I suppose that if I needed to get the day of the week from any date in history, and used this algorithm often enough, I'd eventually think of it as something I didn't have to memorize either.
That seems incorrect, there should always be 51 other days
Notation: "A // B" is integer vision (think Python 3 // operator). "A, B = C /% D" means that "A = C//D" and "B = C % D". "A ≡ B" means A and B are the same mod 7. "A ≡⁴ B" means A and B are the same mod 4. I'll use x for multiplication. X + <a,b,c,d> means the four values A+a, X+b, X+c, X+d.
Let Y be the last two digits of the year.
Observation: 365 ≡ 1. If it weren't for leap years, the year factor would simply go up by 1 each year. A leap year pushes the start of the next year back a day, and that's cumulative, so we need a correction of the number of leap years that have past.
1. That gives the first, and simplest, way to compute the year factor for year Y.
return Y + Y//4
Advantage: simplest algorithm.Disadvantage: numbers get larger than you might be comfortable with for fast mental meth. Doing 99, for example, gives 99 + 99/4 = 99 + 24 = 123 ≡ 4, which has plenty of opportunity along the way to goof.
Many people will do better with a method that uses a little more complicated algorithm but cuts down the size of the numbers.
2. The divide by 12 method, which is the one given in the article, does this.
a, b = Y /% 12
c = b // 4
return a + b + c
Here's why it works. Y = 12 a + b
Y//4 = 3 a + b//4
= 3 a + c
Y + Y//4 = 15 a + b + c
≡ a + b + c
Advantage: a <= 8, b < 12, c < 4. Other than the first /%, you only deal with fairly small numbers.Disadvantage: Still easy for many people to goof on the initial /%.
Note: if you divide by 20 instead of 12, you get a similar method, except that you'll need to use 4a instead of a. Since a is at most 4, 4a is not large. For many people %/ 20 might be sufficiently easier to deal with in mental math than %/ 12 that it is worth the cost of having to multiply by 4.
3. The odd 11 method.
Y += 11 if Y is odd
Y //= 2
Y += 11 if Y is odd
return -Y
The easiest way to see that this works is to go back to Y + Y//4. Write Y = 4q + r, where r = 0, 1, 2, or 3.The first conditional add 11 step turns 4q + <0,1,2,3> into 4q + <0,12,2,14>. Dividing by 2 then gives 2q + <0,6,1,7>. The second conditional add 11 gives 2q + <0,6,12,18>. Negating mod 7 gives 5q + <0,1,2,3>, which is 4q + <0,1,2,3> + q = Y + Y//4.
Similar considerations give other divide by 2 and negate methods. If you note that if Y = 4q, then Y + Y//4 ≡ -(Y//2), then it is just a matter of how to take into account the r in 4q + r when r != 0. One way to do that would be first subtract r, then do the -(Y//2), and then add r back. That works because none of the r != 0 years are leap years, and so we just need to add 1 for each of them.
Another way would be to just go ahead and do -(Y//2), and then add in a correction based on r. Let Y = 4q + <0,1,2,3>. Then -(Y//2) ≡ 5q + <0,0,-1,-1>. We want 5q + <0,1,2,3>, so we have to add 0, 1, 3, or 4 if r = 0, 1, 2, 3, respectively.
That last correction can be split into two parts: add 1 if Y is odd, plus add 2 if Y//2 is odd. That gives:
t = Y odd ? 1 : 0
Y //= 2
t += 3 if Y is odd
return -Y + t
4. The method I actually use, which views the two digit year as a decade part and a year within the decade part, and operates on them separately. Since I gave a long description of it yesterday, I'll just link to that [1] here.My philosophy however is that I don't need to learn this kind of stuff nowadays. There are computers even in our wrist, so I offload as much as I can, and spare my brain cycles more important stuff that matters.