503 lines
32 KiB
Plaintext
503 lines
32 KiB
Plaintext
|
|
Episode: 1240
|
||
|
|
Title: HPR1240: Doomsday Rule
|
||
|
|
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr1240/hpr1240.mp3
|
||
|
|
Transcribed: 2025-10-17 22:10:27
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
Hello and welcome to Hacker Public Radio.
|
||
|
|
I'm Charles in New Jersey and I'm back with a follow-up episode to my recreational math
|
||
|
|
introduction called The End Days of Christmas.
|
||
|
|
You can find those episodes at their episodes number 1143 and 1189 and be sure to get the
|
||
|
|
revised edited version of the second one.
|
||
|
|
In any case, I made an illusion in my very first episode to something called the Doomsday
|
||
|
|
Algorithm.
|
||
|
|
That algorithm is how I attack the problem of figuring out the day of the week for any
|
||
|
|
given date on the Gregorian calendar.
|
||
|
|
I can use this algorithm and find what day of the week some day in history is or even a
|
||
|
|
date that's in a few months or some years down the road.
|
||
|
|
I did not create this algorithm.
|
||
|
|
I live in New Jersey not far from Princeton University which is where John Conway is a professor.
|
||
|
|
John Conway is a man who's done some very cool math stuff and you should especially check
|
||
|
|
out his work on cellular automata and the game of life.
|
||
|
|
Now leave it at that because those are episodes in themselves just talking about them and
|
||
|
|
creating some Python programs that demonstrate how those things work.
|
||
|
|
But that's another episode for another day.
|
||
|
|
The Doomsday Algorithm helps you solve the problem of these pesky days of the week that
|
||
|
|
seem to move around each year.
|
||
|
|
Well, they don't move randomly exactly.
|
||
|
|
A non-leap year has 365 days.
|
||
|
|
If I want to find out what day of the week this day next year is going to be and this
|
||
|
|
is not a leap year when I'm recording this, I just add 365 days where today is the cocktail
|
||
|
|
party and the date that I want to find is 365 days down the road.
|
||
|
|
Well, if I want to date that's seven days down the road, I can count and find out that
|
||
|
|
if today is Tuesday, a date that's seven days later will also be Tuesday and I invite you
|
||
|
|
to count on your fingers to verify that if you like.
|
||
|
|
But I think if you just look at a paper calendar that's hanging on a wall or a calendar that's
|
||
|
|
in a month view on a computer screen, you'll see that the Tuesdays and the month are
|
||
|
|
seven days apart.
|
||
|
|
If the second of the month falls on a Tuesday, then the second and the ninth and the
|
||
|
|
16th and the 23rd and the 30th will all be on a Tuesday.
|
||
|
|
So for every time I have a seven day stretch, if I subtract that from my number of days
|
||
|
|
that I'm counting out there, it really doesn't matter because I've just eliminated one time
|
||
|
|
around the cycle of one week.
|
||
|
|
So 365 days gives me the same offset from today's day of the week that 15 days does because
|
||
|
|
I've just subtracted 50 weeks right off the top.
|
||
|
|
I've just gone around the week cycle 50 times without changing the date by eliminating
|
||
|
|
that 350 days.
|
||
|
|
Well 15 days is just a fortnight and an extra day or for Americans it's just two weeks
|
||
|
|
and an extra day.
|
||
|
|
So the day of the week for a date that's 365 days in the future shifts the date forward
|
||
|
|
by one day.
|
||
|
|
Sadly you've already noticed that your birthday moves about one day forward in the week each
|
||
|
|
year that passes except for leap years where you have an extra day and if your birthday
|
||
|
|
is in January or February, it jumps two days on the year after a leap year.
|
||
|
|
If you're in the latter 10 months of the year, your birthday moves forward two days in
|
||
|
|
the leap year itself.
|
||
|
|
That leap day on February 29th that actually pushes everything forward that extra day should
|
||
|
|
be straightforward.
|
||
|
|
Okay.
|
||
|
|
Well what that does is it creates a lot of jogging around of the day so you can't just
|
||
|
|
say well in seven years my birthday will fall on a Wednesday again.
|
||
|
|
You can't be sure because it depends on how many leap years are in between.
|
||
|
|
If next year was a leap year then you'd only have to wait five years for your birthday
|
||
|
|
to go around the cycle of one week and land on the same day.
|
||
|
|
If your next leap year is two years out you would have to wait an extra long time because
|
||
|
|
what would happen is the first year would advance it one day then the leap year takes
|
||
|
|
it forward two more days that's three in two years then the third, fourth and fifth
|
||
|
|
years move it out to the fourth, fifth and sixth day respectively.
|
||
|
|
Now that sixth year is a leap year.
|
||
|
|
So now when that leap year comes you jump over your birthday instead of having it fall
|
||
|
|
on Wednesday again it's now Thursday because you've skipped over it and then let's see
|
||
|
|
just another five years before it actually gets back to where it was.
|
||
|
|
So you're now talking about 11 years before your birthday comes back on the actual day
|
||
|
|
of the week.
|
||
|
|
Now it's gone by it once but it has actually taken 11 years to rotate around two exactly
|
||
|
|
falling on that date.
|
||
|
|
So it can be a little tricky to figure out when a certain date on the calendar is going
|
||
|
|
to rotate back around to be on a given day of the week.
|
||
|
|
So that's why it's nice to be able to solve the other problem which is given a date in
|
||
|
|
history or a date in the future.
|
||
|
|
How can I tell what day of the week that will be or what day of the week it was.
|
||
|
|
So let's take a date that's significant to a lot of baby boomers.
|
||
|
|
I used to hear people asking wherever you when JFK was assassinated what were you doing
|
||
|
|
when you heard.
|
||
|
|
Well that date was 22 November 1963.
|
||
|
|
What day of the week was that?
|
||
|
|
Well the Doomsday Algorithm gives me a couple of touchstones.
|
||
|
|
It gives me a collection of days of the year that are both memorable and that all fall
|
||
|
|
on the same day of the week.
|
||
|
|
So if I can identify when any one of them falls on a certain day of the week then all of
|
||
|
|
those dates in the calendar will fall on that same day.
|
||
|
|
Sick wise I get a day of the week that's kind of an anchor for these sets of fixed
|
||
|
|
reference dates that we call Doomsday as of the first year of that actually of the last
|
||
|
|
year of the prior century.
|
||
|
|
So in particular if I have the year 2000 itself this Doomsday set of dates falls on a Tuesday.
|
||
|
|
In 1900 it was Wednesday in 1800 it was Friday.
|
||
|
|
In 1900 it was Sunday, 1600 it was Tuesday again.
|
||
|
|
And I'll explain how I got to that a little bit later.
|
||
|
|
So we're looking for 22 November 1963.
|
||
|
|
Well since I'm in 1900 my anchor day of the week is Wednesday and because I'm in 1963
|
||
|
|
I'll do this in the brute force method.
|
||
|
|
That's 63 years into the century which is 9 times 7 so I can say okay that's put me
|
||
|
|
back in the place where I started and then I've got to count the 15 leap years that fell
|
||
|
|
in 1904, 1908 up to 1960 and 60 divided by 4 is 15.
|
||
|
|
So I've got 63 days that the year years have passed and each one contributed one day shift
|
||
|
|
and then 15 days in there, 15 years in there each contributed an extra one day shift.
|
||
|
|
So I need to add the two.
|
||
|
|
Well 63 basically is the same as zero and 15 is essentially the same as one because it's
|
||
|
|
a fortnight plus one day so 1963 is basically only one day ahead of 1900 in terms of the
|
||
|
|
day of the week where every one of those dates falls.
|
||
|
|
Okay.
|
||
|
|
One of the anchor dates for November is November 7 so that was a Thursday.
|
||
|
|
Because I'm one day ahead of 1900 and 1900 doomsdays are on Wednesday then my doomsday
|
||
|
|
for 1963 is Thursday and November 7 is one of those which means that November 21 is
|
||
|
|
also one of those.
|
||
|
|
Since November 21 was a Thursday, 22 November 1963 was a Friday which is actually the
|
||
|
|
same day of the week that it is this year, 50 years later.
|
||
|
|
And before you start making that into a theorem, it doesn't work for 22 November 1964.
|
||
|
|
Because that date is late in the year, 22 November 1964 jumped from Friday to Sunday whereas
|
||
|
|
22 November 2014 is only going to advance by one day because this is not a leap here
|
||
|
|
and neither is next year.
|
||
|
|
So next year November 22nd will be on a Saturday.
|
||
|
|
So that 50 year rule is not going to work in this case.
|
||
|
|
Okay.
|
||
|
|
Wow.
|
||
|
|
How did you do that?
|
||
|
|
Well, I think before we get too far into this we should probably take a little trip into
|
||
|
|
a subset of calendar math that I'm going to call week math or math that you do on the weekly
|
||
|
|
cycle.
|
||
|
|
I'll start very small and with a fixed date.
|
||
|
|
I'm going to choose Tuesday June 6th year 2000.
|
||
|
|
Now if I want to go three days ahead of that, that would be June 9th.
|
||
|
|
The 6 plus 3 is 9, that's the easy part.
|
||
|
|
And now I'm going to get some practice counting out the days.
|
||
|
|
June 6th is a Tuesday.
|
||
|
|
So three days after that would be one is Wednesday, two is Thursday, three is Friday.
|
||
|
|
So June 9th year 2000 was a Friday.
|
||
|
|
Just to keep myself in practice, what was three days before that?
|
||
|
|
Well, that would be June 3rd.
|
||
|
|
And once again you can use your fingers.
|
||
|
|
June 6th was Tuesday, the 5th was Monday, the 4th was Sunday, the 3rd would be Saturday.
|
||
|
|
Okay.
|
||
|
|
Now suppose I go four days ahead of June 6th 2000.
|
||
|
|
Well, since June 9th was on Friday, we just did that.
|
||
|
|
Four days after would be the 10th and it would be the next day so that would be Saturday.
|
||
|
|
If you'll notice I've computed Saturday June 10th is four days after.
|
||
|
|
Saturday June 3rd is three days before.
|
||
|
|
So if I'm trying to figure out the spread between those days, I can add those numbers
|
||
|
|
because I'm at the cocktail party for both of those counts.
|
||
|
|
And four plus three is seven and they should be on the same date.
|
||
|
|
We may use that later.
|
||
|
|
So it doesn't really matter if you're counting backwards or forward.
|
||
|
|
If you've gone a multiple of seven in all, then you've done a full cycle around the week
|
||
|
|
and you're not going to affect the day of the week relative to your starting point.
|
||
|
|
That's going to be important.
|
||
|
|
So now let's suppose I want to go 29 days forward from June 6th, year 2000, which is
|
||
|
|
the Tuesday.
|
||
|
|
Well, what day of the week should that be?
|
||
|
|
Well, since 28 plus one is 29 and 28 is a multiple of seven, all I've done is spend
|
||
|
|
my wheel four times and I'm back on the same day of the week.
|
||
|
|
So I'm really, if I'm adding 29 in terms of days of the week, I'm just adding one.
|
||
|
|
I'm adding a remainder or an offset of one.
|
||
|
|
If you think of it that way, you can whittle down problems to a much easier set of things
|
||
|
|
to solve.
|
||
|
|
So what day of the week is 6 June plus 29 days?
|
||
|
|
Well, 6 June was a Tuesday.
|
||
|
|
So that date must be a Wednesday.
|
||
|
|
Now to check it, 6 June 2000 plus 29 would be effectively June 35, remember we learned
|
||
|
|
how to do this last time.
|
||
|
|
And because June has 30 days, that would be 5 July and since 11 July is one of my Doomsday
|
||
|
|
reference dates, which I will list for you soon, then 4 July is also and 4 July is Tuesday
|
||
|
|
as is June 6.
|
||
|
|
So July 5th is again on Wednesday.
|
||
|
|
So everything's working.
|
||
|
|
Okay.
|
||
|
|
Now, we can start deriving the Doomsday rule and using it.
|
||
|
|
Now there's some basic insights we can have here and we'll start with Doomsday itself.
|
||
|
|
I think you should think of that as the last day of February because that's the date
|
||
|
|
that's really moving things around in the calendar when you have a leap year.
|
||
|
|
So we might as well just focus on it because that's the one that's going to be our pivot,
|
||
|
|
whether it's the 28th of February or whether it's the 29th of February on a leap year.
|
||
|
|
So we might as well use that as a starting point.
|
||
|
|
Well, since we're using the last day of February as our anchor point, then you could either
|
||
|
|
say that March 0 is, which is the same thing, is also a Doomsday or it's probably more
|
||
|
|
convenient to say March 7 and you'll see why in a second because it's just one week later
|
||
|
|
it's an actual day of the month rather than some kind of artificial construct and it
|
||
|
|
turns out to be easier because it's consistent with a rule that's going to emerge in just
|
||
|
|
a few moments.
|
||
|
|
Now the months of the year, once you hit the month of April, the months of the year can
|
||
|
|
be arranged in pairs in which one month is 30 days and one month is 31 days.
|
||
|
|
Now sometimes those are in different order so that you get two months in a row of 31
|
||
|
|
days but they're bracketed by months that are 30 days long.
|
||
|
|
So let's find an anchor date for April.
|
||
|
|
Well since March 7 is the same day of the week as the last day of February, then March
|
||
|
|
35 would also be because it's 28 days later or four weeks and that translates to April
|
||
|
|
4.
|
||
|
|
Hmm, April 4, 4 4 is pretty easy to remember.
|
||
|
|
Well, because 4 4 is an anchor date, that's going to turn out to be really convenient
|
||
|
|
because since April has 30 days and May has 31 days, that's 61 days and that's just
|
||
|
|
two days short of nine weeks.
|
||
|
|
So to go from 4 4 to 4 June, gotcha, you thought I was going to do it in one or the other
|
||
|
|
of the number only format.
|
||
|
|
So what if I went from 4 4 6 6, that's nine weeks, that's the same day of the week.
|
||
|
|
And watch me now, June is also 30 days and July is 31.
|
||
|
|
So if I go from 6 6 to 8 8, same day of the week, it's 63 days, same day of the week.
|
||
|
|
So 4 4 6 6 8 8, but wait this more August has 31 days and September has 30.
|
||
|
|
So from 8 8 to 10 10, nine weeks, same day of the week, oh but October has 31 days, November
|
||
|
|
has 30, 10 10 to 12 12, 63 days, nine weeks, same day of the week.
|
||
|
|
So what I have so far, I have the last day of February and I have 4 4 6 6 8 8, 10 10 and
|
||
|
|
12 12, all the even numbers after that first couple of months, all in the same date, 4 4 6 6
|
||
|
|
8 8, 10 10 12 12, couldn't be easier.
|
||
|
|
Now the odd months are not that easy and what happens is in the early part of the year,
|
||
|
|
I take the number of the month and you add 4, so March 7, as we've already seen, I'm
|
||
|
|
going to claim that May 9, 7 11 are also, or May 9 and July 11, sorry, I got that backwards
|
||
|
|
for you, are also doomsdays.
|
||
|
|
And fortunately, I said 5 9 and 7 11, American style, well if you look at 5 9 and 11 7
|
||
|
|
or if he and, or international style dates, those are also doomsdays.
|
||
|
|
So 9 May, 5 September, both doomsdays, there's a sentence that people use as a mnemonic
|
||
|
|
for this that I work my 9 to 5 job at 7 11, which may work in the states because there's
|
||
|
|
a chain of convenience stores called 7 11, so we could remember that, okay, I'm working
|
||
|
|
a 9 to 5 shift at a store called 7 11, but however you remember it, in the first half
|
||
|
|
of the year it's the odd month you add 4, so March 7, May 9, July 11, and then you just
|
||
|
|
reverse those for the second part of the year, which would be 5 September and 7 November.
|
||
|
|
Now January and February are affected by the leap year, on a non-leap year, the last
|
||
|
|
day of February, which is the definition of doomsday, is the 28th, which means that January
|
||
|
|
31st, which is 28 days before that, if the cocktail party is on the 31st, then the 28th day
|
||
|
|
on is the last day of February.
|
||
|
|
So on a non-leap year, January 31st is a doomsday, which means it might be easier to think of 10
|
||
|
|
January, as the doomsday for January, and on a leap year, instead of saying February
|
||
|
|
1st and then having to back into it, you could say that 11 January is the doomsday reference
|
||
|
|
point for January, and February 29th, of course, would be the reference point for February.
|
||
|
|
However, you remember it is fine, just, you know, you can compute your favorite thing
|
||
|
|
to remember, there are a lot of possibilities, I don't want to limit you by forcing them
|
||
|
|
upon you.
|
||
|
|
Now it's nice to have these reference dates that I can use for any year that I'm in,
|
||
|
|
especially since they never move for the dates that are after February 29th, doomsday,
|
||
|
|
or 28th, if it's not there, and there's just a rule that I have to remember that it moves
|
||
|
|
a little bit in January for years that are leap year, instead of being 10 January,
|
||
|
|
it's 11 January, so you just need a friend whose birthday is 11 January, or get married
|
||
|
|
on that date, and then you can either always remember it, or I guess never remember it,
|
||
|
|
depending on what kind of person you are.
|
||
|
|
If you're male, you probably will forget it.
|
||
|
|
The next maneuver that I did that seemed a little bit iffy was this anchor date for
|
||
|
|
the century thing, and it turns out that you can figure out the way the dates move over
|
||
|
|
large numbers of years, quite easily, because there's this extra rule that you get with
|
||
|
|
leap years in that, yes, every fourth year is a leap year, unless it's a multiple of 100,
|
||
|
|
then it's not a leap year, well, unless it's a multiple of 400, then it is a leap year.
|
||
|
|
What that little exception does is it knocks you into a 400-year cycle, where every year
|
||
|
|
that is a multiple of 400, like, say, 1600, 2000, 2400, 2800, those are all years in which
|
||
|
|
all of the dates are aligned from 1 January to 31 December, so you've got these 400-year
|
||
|
|
cycles.
|
||
|
|
Now, how am I supposed to believe that I have 400-year cycles?
|
||
|
|
Well, let's count, okay?
|
||
|
|
Let's say I'll start at 1600 as my base year, and I want to see what happens to Doomsday
|
||
|
|
in 1700.
|
||
|
|
Well, I've got 100 years between 1600 and 1700, 1600 is the equivalent of the cocktail
|
||
|
|
party, so the 100 years are 1601, 1602, 1603, and so on up to 1700.
|
||
|
|
Each year is pushing the dates ahead by one, and then there are 25 of those years that are
|
||
|
|
multiples of four, one of which is not a leap year, so that's 24, so you only get 24
|
||
|
|
extra days out of that, so I could say that's a total of 100 plus 24 or 124, and what's
|
||
|
|
that in terms of weeks?
|
||
|
|
Well, here's a little trick.
|
||
|
|
The 100 is already a reduction of the 365 times 100 plus 24, so we're really reducing
|
||
|
|
36,524 to a remainder after you divide by seven, but as I said before, since each year
|
||
|
|
pushes the data head by one, I've already done this reduction of the 365 to one, and
|
||
|
|
I could just as well reduce the 100 to, well, that's 98 plus two, and if I just eliminate
|
||
|
|
the 98 because that's an even number of weeks, I end up with plus two.
|
||
|
|
Now the 24 leap days that I've seen in that century is actually 21 leap days, so I've
|
||
|
|
gone three whole weeks plus three extra days, so I've got two days from the plus one for
|
||
|
|
every year, and basically a net of plus three for the leap days, two and three is five,
|
||
|
|
you can think of it as pushing me ahead five days, or actually falling short of going around
|
||
|
|
the cycle completely by two days.
|
||
|
|
I prefer the minus two because it's a little easier, but you can do what you like, so what
|
||
|
|
happens is in the year 1600 itself, Doomstay is on a Tuesday, because it always is.
|
||
|
|
In 1700, I go forward a hundred years, and I'm two days short of going around the cycle
|
||
|
|
even number of weeks, so that Tuesday becomes an anchor date of Sunday for that century.
|
||
|
|
So everything I do within that 100 year period is going to be based off Sunday instead
|
||
|
|
of Tuesday.
|
||
|
|
I can do the same thing from 1700 to 1800, so the anchor date for 1800 and the 1800s
|
||
|
|
would be Sunday minus two days, or Friday, and the same thing applies from 1800 to 1900
|
||
|
|
and drive lost two days, so the anchor date for the 1900s would be Wednesday, two days
|
||
|
|
before Friday.
|
||
|
|
Now from 1900 to 2000, I have the same situation as I had before where I've lost two days
|
||
|
|
for everything up to 2000, but 2000 is a leap year, so I've actually only lost one date
|
||
|
|
in that century, so I'm back to Tuesday.
|
||
|
|
So I think we've just established that in every 400 year period that starts with a multiple
|
||
|
|
of 400 as the cocktail party year, then the days of the week cycle around completely
|
||
|
|
over that 400 year period, so that 400 year, year 2000, the end date, which is the cocktail
|
||
|
|
party for the next cycle, is the same set of days of the year as the beginning in 1600.
|
||
|
|
2400 would also have the D days, so it will all be on Tuesday, which would be January 11,
|
||
|
|
March 7, April 4, May 9, June 6, July 11, August 8, November 5, October 10, and December 12.
|
||
|
|
Those dates will all be on Tuesday in the year 2400.
|
||
|
|
I won't be around to see that, I'm not sure I want to be, because I'd be quite old
|
||
|
|
by that point.
|
||
|
|
Okay, now what happens within a century?
|
||
|
|
Well, because I need an offset of plus one for every year that's transpired, I know I've
|
||
|
|
got that as my base, so if I've got a year within the century, I know I have to add
|
||
|
|
at least that many days, and then I have to add the number of leap years that have already
|
||
|
|
occurred, including if the current year is a leap year.
|
||
|
|
Because D day is the last day of February, I'm not missing anything by including the current
|
||
|
|
year as a leap year, because my doomsday date adjusts to the last day of February, whatever
|
||
|
|
that is.
|
||
|
|
So good.
|
||
|
|
So now let's do a couple of examples, because that'll help us fix ideas.
|
||
|
|
And I guess one example we could try, that would be easy to remember, would be D day,
|
||
|
|
the date of the Normandy invasion, which would be 6 June 1944, what kind of day of the week
|
||
|
|
was that?
|
||
|
|
Well, I'm going to do the brute force version before I introduce the shortcut.
|
||
|
|
And that is, I take the 1900 anchor, and that's Wednesday, and if you want to figure
|
||
|
|
that out, it's 1600 is the greatest multiple of 400 that's less than the date, and I just
|
||
|
|
subtract off two days from Tuesday for each hundred years.
|
||
|
|
So Tuesday, Sunday, Friday, Wednesday.
|
||
|
|
Okay.
|
||
|
|
So Wednesday is the base anchor date for the 1900s.
|
||
|
|
Now I'm 44 years into that century, and I have 11 leap years, including 1944 itself.
|
||
|
|
So I can either say that that's plus 55, and notice that's one less than 56, and say
|
||
|
|
it's minus one, or I could have said that 44 is 42 plus two, and 11 is seven plus four,
|
||
|
|
and so that two plus four is six, which is also minus one.
|
||
|
|
So the Doomsday would be on Tuesday for 1944, but as we've already seen, June 6 is one
|
||
|
|
of the monthly anchor dates, so D-Day was Tuesday.
|
||
|
|
For a second example, one of my relatives was born on January 20, 1898.
|
||
|
|
Okay, now the 1800 anchor is Friday, so for that whole century, I'm anchoring on Friday.
|
||
|
|
Now I've got a 98-year offset, and 98 happens to be a multiple of seven, so I can just neglect
|
||
|
|
that entirely.
|
||
|
|
And I had the maximum number of leap years, which is 24, and that is 21 plus three.
|
||
|
|
So the Doomsday would be Friday plus three, which is Saturday plus two, Sunday plus one,
|
||
|
|
or Monday.
|
||
|
|
So that means the Doomsday dates are all on Monday that year.
|
||
|
|
So since 1898 is not a leap year, we have the 28th of February is Monday, which means
|
||
|
|
the 31st of January is Monday.
|
||
|
|
And two weeks before that, so I'm adding, is the 17th of January, and that's also Monday.
|
||
|
|
Since the 20th is three days later, the 20th of January, 1898 is Thursday.
|
||
|
|
Now just to show you that this is not pure trickery, I could do this by the extreme brute force
|
||
|
|
method.
|
||
|
|
That is the anchor date for 1600, the Doomsday date in 1600 is Tuesday.
|
||
|
|
1898 is 298 years after 1600, of 280 of those years, just take me around the week about
|
||
|
|
40 times, leaving remainder 18, which is four more than 14, which is two weeks.
|
||
|
|
So the 298 one day shifts give me a net of plus four.
|
||
|
|
Now in that 298 years, there were 74 multiples of four at 1604, blah, blah, blah, blah,
|
||
|
|
1896.
|
||
|
|
And there were 74 of those, but two of them were century ending dates, which were not leap
|
||
|
|
years.
|
||
|
|
So we can't count them in the leap year offset count.
|
||
|
|
So actually my leap year offset is now 72, which is two more than 70, and I've got four
|
||
|
|
and two is six.
|
||
|
|
So for that year, the Doomsday is on not Tuesday, but Monday.
|
||
|
|
That's using an almost 300 year offset, and I still get the same Doomsday result.
|
||
|
|
Wow.
|
||
|
|
Factoring 98 and finding number weeks in there and finding the leap years is dealing with
|
||
|
|
numbers that are getting a little bit challenging for most people's ability to do mental arithmetic.
|
||
|
|
So there must be a way to make this a little simpler to use smaller numbers, and I think
|
||
|
|
we can.
|
||
|
|
And the way Conway proposed was to look at the sequence of 12 year cycles that you can
|
||
|
|
fit into a century.
|
||
|
|
And there's only eight of those and a little bit over.
|
||
|
|
So you're not really talking about a lot to keep track of.
|
||
|
|
Why would you choose the number 12?
|
||
|
|
Well, if you look at the first 12 years of a century, let's use the 1900s as an example
|
||
|
|
because that's fairly easy to look at.
|
||
|
|
Now 1900s the cocktail party.
|
||
|
|
So the first 12 years are actually 1901, 1902 up to 1912.
|
||
|
|
Since each year pushes the day of the week for each date forward by plus one, I've got
|
||
|
|
a plus 12 offset right there.
|
||
|
|
And in those 12 years, I've got how many leap years I have three.
|
||
|
|
I can even name them.
|
||
|
|
They're in 1904, 1908, 1912.
|
||
|
|
And 1912 becomes the cocktail party for the next set of 12.
|
||
|
|
So we get the same behavior.
|
||
|
|
Because I have plus 12 from the years themselves and additional three from the leap years in
|
||
|
|
that 12 year cycle, I have a total offset of plus 15, which gives me a plus one for the
|
||
|
|
entire 12 years.
|
||
|
|
And that's all the information I really need.
|
||
|
|
I don't care how many times I went through the cycle.
|
||
|
|
I don't care that it's actually 15 days.
|
||
|
|
The plus one is enough information.
|
||
|
|
So if I wanted zero in on, let's say, D day in 1944, the same date we did before, another
|
||
|
|
way to look at that is how many of these 12 year cycles have already passed, how far
|
||
|
|
I am into the current one, and how many leap years have I seen in the current 12 year
|
||
|
|
cycle?
|
||
|
|
Well, 44 is three times 12, which is 36, plus eight years into the current cycle.
|
||
|
|
And then how many leap years have I had in the current cycle, that's the eight years
|
||
|
|
divided by four.
|
||
|
|
And remember, if this year is a leap year, I count that.
|
||
|
|
So the offset for 1944 is going to be three from the three times 12, plus eight, which
|
||
|
|
is really plus one net.
|
||
|
|
So three in one is four, and then eight over four, that's the number of leap years,
|
||
|
|
but it's actually equal to two.
|
||
|
|
So I've got three plus one plus two, it's minus one that's one down from the anchor date
|
||
|
|
of the century, which is Wednesday.
|
||
|
|
So D day is again on Tuesday, and six June is one of the one of the doomsday reference
|
||
|
|
dates for the year.
|
||
|
|
So very cool.
|
||
|
|
Now for the 1898 thing, well, instead of having 98 is how many sevens and so on, well 98
|
||
|
|
is eight times 12 plus two, and I'm two years into this, so I haven't had a leap year.
|
||
|
|
So my offset is eight plus two plus zero, because I have no leap years, and that's ten,
|
||
|
|
which is equivalent to plus three, because I don't care about that extra week.
|
||
|
|
So I'm plus three, and Friday plus three is Monday, and I'm back where I was in 1898.
|
||
|
|
And that means January 17 was a Monday, and I believe that's what I said in my original
|
||
|
|
comments.
|
||
|
|
So we have a way to figure out what our date of birth was, or our wedding anniversary,
|
||
|
|
days of the week, and so on.
|
||
|
|
How would this be useful, let's say, in planning a meeting?
|
||
|
|
You never know, there's always something that needs to be planned a few weeks in advance.
|
||
|
|
So let's say I'm going somewhere September 28th.
|
||
|
|
What day of the week is that this year?
|
||
|
|
As I'm recording is 2013, doomsdays are on Thursday this year.
|
||
|
|
Now in September, 9.5 if you're in the states, 5.9 if you're anywhere else would fall on
|
||
|
|
a Thursday, which means that the 12th, the 19th, the 26th is Thursday, and the 28th is
|
||
|
|
two days after that.
|
||
|
|
Let's see, I can use my fingers now, I'm down to two days.
|
||
|
|
The 26th is Thursday, 27th is Friday, 28th is Saturday.
|
||
|
|
See, it's handy even within a year, you don't have to do a lot of calculating, especially
|
||
|
|
if you are aware of this to the point where you know the doomsday for this year, you don't
|
||
|
|
have to calculate it again and again.
|
||
|
|
For 2013, Thursday, right?
|
||
|
|
The 2014 is going to be Friday, 2015, it's going to be Saturday, 2016, now it's going
|
||
|
|
to jump and it will be, what, it will be Monday.
|
||
|
|
Now maybe I should check that for the year 2000, anchor date is Tuesday, 2016, okay,
|
||
|
|
16 is 1 times 12 plus 4, so I got plus 1 for having gone through an entire 12 year cycle.
|
||
|
|
I've got 4 years into the current cycle and it's a leap year so I count that one too.
|
||
|
|
So 1 and 4 and 1 is 6, which is minus 1, so doomsday is Monday, which is what I hope I
|
||
|
|
just said.
|
||
|
|
That's really all you need to know to both explain how it works, this doomsday rule,
|
||
|
|
and to use it in practice.
|
||
|
|
Now if you want to do one of the brute force calculations, that might be okay for a spreadsheet
|
||
|
|
where you have tools that will help you like the mod function.
|
||
|
|
All that stuff I was doing by reducing the numbers by throwing out all the extra weeks,
|
||
|
|
a spreadsheet like numeric or library office, calc or the dreaded Excel or whatever, is
|
||
|
|
going to have a mod function and what that does is it returns that offset number that
|
||
|
|
I've been seeking all this time, which is the remainder when you divide by 7.
|
||
|
|
It strikes out all of the whole number times that 7 divides the number that you're trying
|
||
|
|
to evaluate and gives you just the remainder.
|
||
|
|
That's how the mod function works.
|
||
|
|
To confirm that offset in a century that does not end in a multiple of 400, I can count
|
||
|
|
the number of days in that century, which would be 36,524, then if I just plug that number
|
||
|
|
into a formula by saying mod then the number 36,524, comma 7, that will give you the remainder
|
||
|
|
from dividing 36,524 by 7 and it should come out to be the number 5.
|
||
|
|
In any case, that's the spreadsheet trick that would let you use ultra brute force methods
|
||
|
|
to do this calculation.
|
||
|
|
I think what I will do is have a spreadsheet that will have one sheet that does the
|
||
|
|
doomsday rule with the division by 12, the remainder and the number of leap years in
|
||
|
|
the current cycle and figures out the offsets and the centuries and even the doomsday numbers
|
||
|
|
if I do a table look up on the doomsday numbers then you'll have them and you won't forget
|
||
|
|
them.
|
||
|
|
The evens are easy to remember because it's 4, 4, 6, 6, 8, 8, 10, 10, 12, 12.
|
||
|
|
The odds are 3 plus 4 is 7, so 3, 7, 5, 9, 7, 11 and then you can flip those to get 9,
|
||
|
|
5 and 11, 7, whether you're living in the US or Europe, those should all be fine.
|
||
|
|
If you're not in the US then you want to remember 7 March, so it'd be 7-3 as opposed
|
||
|
|
to 3-7 and then it's the last day of February, whether it's the 28th or the 29th and in a non-leap
|
||
|
|
year, the January reference date is the 10th in the leap year it's the 11th.
|
||
|
|
That pretty much sums that up so when I give you the spreadsheet and I do a look up on
|
||
|
|
that first very detailed page, it'll have a look up table where you can refresh your
|
||
|
|
memory and look at those again.
|
||
|
|
Or you can modify them to use dates that mean more to you.
|
||
|
|
If your aunt Frida has a birthday in January that happens to be one of the target dates
|
||
|
|
then maybe you'll remember it better by having aunt Frida's birthday as opposed to one
|
||
|
|
of the anchor dates that I proposed.
|
||
|
|
Okay and then I'll do the more brute force approach where I just did the divisions and
|
||
|
|
the mod 7 calculations within a century and stretching all the way back to the base
|
||
|
|
of the century, the 1600 for that 298 year calculation.
|
||
|
|
It's all the same calculation really, it's just that these extra maneuvers are to make
|
||
|
|
it a little bit more convenient for humans who are doing mental math.
|
||
|
|
The creator of this rule, John Conway, has a program on his computer that generates
|
||
|
|
a date so it gives him a date he has to calculate the day of the week on which that date falls
|
||
|
|
and his program only gives him a few seconds and he can do it in that short a time because
|
||
|
|
he's been practicing it for years so the doomsday portion of his brain is pretty well developed.
|
||
|
|
But I'll probably rot your brains by giving you the spreadsheet that gives you ways to
|
||
|
|
get at the answer and lets you play with how you do it so you can actually come up with
|
||
|
|
your own variant.
|
||
|
|
If you look on Wikipedia, the article on doomsday rule, there and that will be a link
|
||
|
|
in the show notes as well.
|
||
|
|
There's actually a faster way to get at this but it's got a quantity that I'm not sure
|
||
|
|
everyone who is listening to this will remember.
|
||
|
|
But if you want to look that up, program it, use it, I'm sure it's fine.
|
||
|
|
I don't find that it takes me a long time to do this calculation.
|
||
|
|
In fact, the thing that takes me the longest is figuring out the day of the week for a
|
||
|
|
date in the month that's not on the same day as doomsday.
|
||
|
|
So it's that last one or two or three day, maybe four day offset that.
|
||
|
|
It's usually the last couple of steps that throw me off and not the big multiplications
|
||
|
|
or divisions that are causing any problems.
|
||
|
|
So that's all I have for today.
|
||
|
|
You can practice up and amaze your friends with your newfound skills in computing the
|
||
|
|
days of the week of any date and you'll be able to use this for fun and profit.
|
||
|
|
This is an interesting topic.
|
||
|
|
It could be helpful to you.
|
||
|
|
I hope you've enjoyed this episode and that you'll be able to use this for fun and
|
||
|
|
profit.
|
||
|
|
So until next time, I'll be looking forward to your episode on Hacker Public Radio.
|
||
|
|
Think about putting it in a show, okay, thanks.
|
||
|
|
You have been listening to Hacker Public Radio where Hacker Public Radio does our.
|
||
|
|
We are a community podcast network that releases shows every weekday on day through Friday.
|
||
|
|
Today's show, like all our shows, was contributed by a HBR listener like yourself.
|
||
|
|
If you ever consider recording a podcast, then visit our website to find out how easy
|
||
|
|
it really is.
|
||
|
|
Hacker Public Radio was founded by the Digital Dog Pound and the Infonomicum Computer
|
||
|
|
Club.
|
||
|
|
HBR is funded by the binary revolution at binref.com, all binref projects are crowd-sponsored
|
||
|
|
by lunar pages.
|
||
|
|
Of shared hosting to custom private clouds, go to lunarpages.com for all your hosting
|
||
|
|
needs.
|
||
|
|
Unless otherwise stasis, today's show is released under a creative commons, attribution, share
|
||
|
|
a line, lead us our license.
|