Mar. 29th, 2012

fiat_knox: silhouette of myself taken at sunrise (Default)
This technique first came to me in the book "Figuring: The Joy of Numbers" by Shakuntala Devi, back in the 1970s would you believe it.

The method enables you to work out what day of the week any particular date falls on in any year. Technically, the technique needs tweaking for the 1600s - 1800s, and for 2200 on up, but as long as we currently keep using the present Gregorian calendar with a seven-day week this system should work.

I'll just show you how to apply this technique to dates in this century (the 21st) and the dear, departed 20th century.

If you've already seen this elsewhere I have to show you the technique again, because I want to show you something really cool about something I just worked out about the technique this morning, but in order to show you the engineering I have to show you the car, don't I?

First, you must understand that the technique relies on what you would call Modulo 7 in mathematics. Modulo 7 numbers range from 0 - 6. If a number equals or exceeds 7 or a multiple of 7, subtract the nearest multiple of 7 until you get a number between 0 and 6. If you get -1, it becomes 6.

The calendar date has three components: the day of the month, the month and the year. The months of the year have a table to follow, and the years have a number assigned to them.

The Technique



We'll use September 23, 2013 as our first example.

1. Work out the modulo 7 value of the date.

You need to determine the nearest multiple of 7 less than 23, or 21.

23 - 21 = 2.

2. Add the month number and work out the modulo 7 value of this total.

Month Table



MonthNumber
January0
February3
March3
April6
May1
June4
July6
August2
September5
October0
November3
December5


That looks like a lot to remember, but think of it as kind of like remembering a twelve digit phone number: 033614 625035 - and just remember which month goes with which digit, and you'll do fine.

The wonder I discovered this morning comes from this month table, but we haven't got to that yet. Just use the month table, learn it, memorise it, and you'll have two thirds of this technique nailed.

Now to use the technique on the number we came up with from part 1 on 23 September 2013.

Look up the value to the right of September in the month table: 5.

2 + 5 = 7.

7 modulo 7 = 0.

3. Add the year number and work out the modulo 7 value of this total.

How do we work out the year number? Well, here we get to the most complex part of the technique, and sadly you have a lot to remember.

You have to remember a sequence of numbers corresponding to leap years.

Number
6
4
2
0
5
3
1


If you want to work out a date falling on a leap year, work out the year number and use that. So a date falling in 2012, for example, would use the 2012 leap year number.

If the date does not fall in a leap year, use the nearest leap year less than that, and add the difference between that leap year and the year of your date.

Let's look at 23 September 2013. Now we need to know the year number. In this case, it will help to know the year number for 2000: 6.

Leap YearNumber
20006
20044
20082
20120
20165
20203
20241
20286


2013 - 2012 = 1. 1+0 (the year number for 2012) = 1.

1+0 = 1. We already have the modulo 7 value: 1.

4. Work out the day number.

DayNumber
Sunday0
Monday1
Tuesday2
Wednesday3
Thursday4
Friday5
Saturday6


From our example of 23 September 2013, 1 works out as a Monday.

23 September 2013 falls on a Monday. Google it to confirm. I'll wait till you get back.

Now let's look at a date you can confirm: today, March 29 2012.

Modulo 7 of 29 = 29 = 28 = 1.

Add the month number for March, 3; 1+3 = 4.

Add the year number for 2012, 0; 4+0 = 4.

Look up the day for the value 4 - Thursday.

The technique needs two tweaks that you'll have to remember.

First of all, for any date falling in January and February of any leap year, subtract 1 and treat a result of -1 as 6.

Let's look at February 28, 2012.

28 modulo 7 = 0. 0+3 (3 corresponds with February) = 3. 3+0 (the year number for 2012) = 3.

Because the date falls in February of a leap year, subtract 1; 3-1 = 2.

28 February 2012 fell on a Tuesday.

Let's look at 18 February 2012.

18-14 = 4; 4+3 = 7; 7 mod 7 = 0; 0-1 = -1, which you read as 6.

18 February 2012 landed on a Saturday.

And the other tweak? You'll need this to work out dates falling in the 20th century. Century years don't count as leap years unless you can divide the number evenly by 400. You can divide 2000 by 400; you can't with 1900, so 1900 doesn't count as a leap year.

1900, however, does have an entry in the leap year tables for the 20th century:-

Leap YearNumber
19000
19045
19083
19121
19166
19204
19242
19280


and so on, with the 6 - 4 - 2 - 0 - 5 - 3 - 1 cycle repeating every 28 years (7 for modulo 7, 4 for the leap years, 7 x 4 = 28).

If you wanted to get rally geeky and commit individual year numbers to memory, not just leap years, just remember the 28 year number cycle template and apply this:-

Number
6*
0
1
2
4*
5
6
0
2*
3
4
5
0*
1
2
3
5*
6
0
1
3*
4
5
6
1*
2
3
4

* = leap year

... and the cycle begins anew.

I have given you wonders enough by showing you this technique, and I love using it. But I have one more thing to show you. Let's go back to the month table above, and the somewhat idiosyncratic sequence of 0,3,3,6,1,4,6,2,5,0,3,5. How did Shakuntala Devi ever come up with that sequence? Easy.

If every month had exactly 28 days, four weeks of seven days, we would not need to have a month table - every date for every month would fall on the same day of the week. But we don't have months of equal length; we have months of 28, 29, 30 and 31 days.

And this morning I just worked out why the month table has this eccentric pattern.

Modulo 7.

The first month number always starts with 0 for January. If January had 28 days, February's would also correspond to 0, as would March. But January has 31 days, and 31 - 28 = 3. So we assign 3 to February. We can also assign 3 to March because, in general, February does have 28 days, so 3+0 = 3. Adding another 3 (31-28 = 3) to 3 we get the number 6 for April, and adding 2 (30-28 = 2) to that yields 8, which in turn yields 1 (8-7 = 1) for May.

Each time, you deduct 28 from the month's length and add that to the running total, working out the modulo 7 value until you get to December's value of 5.

A simple, elegant solution, and I only noticed that just today.

I love using this technique, and the more I study it the more I learn about how it comes together. I hope you find a use for it yourselves, and have a lot of fun working out days and dates, and possibly surprising people who never knew you had the skill in you.

March 2025

S M T W T F S
      1
234 5678
9101112131415
16171819202122
23242526272829
3031     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 3rd, 2025 02:00 pm
Powered by Dreamwidth Studios