What day was it

So for quite a while now, I've wanted to be able to figure, given a date, what day of the week it was. Clearly it's possible to do. When I looked at google, there were several sites that wanted you to memorize tables, etc. At any rate, I just worked on it a bit, and the algorithm works. Unfortunately, my thinking is not as fast as it once was, and something like 20% of the time I make a mistake. This describes the method I use to calculate the day of the week from 1900 to 2099.

For 1900+, (for 2000+ subt 2)

Two digit year, +year/4 (1904, 5, 6, 7 =1, 1944, 5, 6, 7 =11)

-1 if leap-year and Jan/Feb

+ day

+ month bias (days over 28 - starting in Feb, 3 3 6 8 11 13 16 19 21 24 26)

While working, divide by 7 and use remainder at any time.)

The last remainder is 0=Sun, 6=Sat)

This week I tried to be more organized about trying it. I picked a few dates, and did the calculation for several years, writing everything down so I could see where I was wrong. Under "date" are the dates that I tried. Under 1900, (and succeeding years) you see a # and day. # is what I calculated, and the day that goes with it. Where you see 2 (or more) numbers, they indicate wrong guesses. Seems that I just cannot keep the calculation straight in my head. I'd like to think that at one time, I would have been able to do it, but that time is not this time. Unfortunately.

The logic is pretty simple, Jan 1, 1900 is calculated by adding 0 for the year and 0 for leap year and 0 for month offset, and the date, "1". 1 is Monday, 2 is Tuesday, etc. I wrote it all out because before, when working it, I was often wrong. The question was, was there an error in the algorithm or just my thinking? Turns out it was/is my thinking.

http://www.infoplease.com/calendar.php (handy site to check dates)

date 1900 1904 1905 1932 1946 1952 1966 1991 2000

Jan 01 1 mon 5 fri 0 sun 6/5 fri 2 tue 2 tue 6 sat 42 tue 06 sat

Jan 23 2 tue 6 sat 1 mon 0/6 sat 3 wed 3 wed 0 sun 53 wed 10 sun

feb 23 5 fri 2 tue 4 thu 6/2 tue 6 sat 36 sat 23 wed 6 sat 3 thu

mar 22 4 thu 2 tue 3 wed 3/2 tue 5 fri 6 sat 2 tue 5 fri 3 wed

may 12 6 sat 4 thu 5 fri 5/4 thu 0 sun 21 mon 624 thu 0 sun

jul 31 2 tue 0 sun 1 mon 0/10 sun 3 wed 54 thu 010 sun 43 wed

oct 12 5 fri 3 wed 4 thu 4/3 wed 6 sat 0 sun 3 wed 6 sat 4 thu

nov 18 0 sun 5 fri 6 sat 6/5 fri 1 mon 2 tue 5 fri 1 mon

dec 01 6 sat 4 thu 5 fri 6/54 thu 50 sun 8 mon 34 thu 0 sun

dec 25 2 tue 0 sun 1 mon 1/0 sun 3 wed 4 thu 0 sun 3 wed

month bias (3 3 6 8 11 13 16 19 21 24 26) oct=0 3 5 may=1 4 6 9 12

There's nothing you have to remember - you can calculate the month table knowing how many days are in each month. I did write it down, so I didn't have to do that every time. After a bit, it is pretty easy to remember. Other than that, it's all calculation. When working it, generally I start with year, divide by 7 and save the remainder. Then I do the leap-year calc, add in the saved #, divide by 7 and save that. Then I add in the month bias, because some months have more than 28 days. Last, I add in the date, and divide by 7. The result, 0-6 is the day of the week, Sun-Sat. And if I could keep it in my head, it would always work out.

So what's next? Will practice fix my logic? Somehow I don't think so. It won't hurt, but I doubt that I'll get better. I was thinking that, if I ever got to talk to a school math class again, I could use this. Probably not. Explaining it would take up too much of the time. (Last time, after class, I got invited back to the last class of the day, with the same class again, because they liked me. (Or I was better than a regular old math class.) Some things are worth it.) In any case, there's way more than a single period's stuff to talk about.