% cal 9 1752

September 1752

Su Mo Tu We Th Fr Sa

1 2 14 15 16

17 18 19 20 21 22 23

24 25 26 27 28 29 30

## Friday, December 2, 2011

### Unix cal program for September 1752

//calendar for September 1752

## Monday, October 24, 2011

### Prepare to Meet Thy Doomsday

I wrote an article for Scientific American regarding the Doomsday algorithm.

"What Day is Doomsday? How to Mentally Calculate the Day of the Week for Any Date"

special thanks to John Matson for the editorial work.

Chinese translation: http://www.ccglim.com/11434.html

"What Day is Doomsday? How to Mentally Calculate the Day of the Week for Any Date"

special thanks to John Matson for the editorial work.

Chinese translation: http://www.ccglim.com/11434.html

## Sunday, August 7, 2011

### Sakamoto's Algorithm

Tomohiko Sakamoto came up with a terse program for calculating the day of the week in 1993. His code was written in the C language. The non-portable code goes like this:

int dayofweek(unsigned int y, unsigned int m, unsigned int d)

{

y -= m < 3;

return (y + y/4 - y/100 + y/400 + "-bed=pen+mad."[m] + d) % 7;

}

Here is the portable version:

int dayofweek(int y, int m, int d)

{

static int t[] = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 };

y -= m < 3;

return (y + y/4 - y/100 + y/400 + t[m-1] + d) % 7;

}

int dayofweek(unsigned int y, unsigned int m, unsigned int d)

{

y -= m < 3;

return (y + y/4 - y/100 + y/400 + "-bed=pen+mad."[m] + d) % 7;

}

Here is the portable version:

int dayofweek(int y, int m, int d)

{

static int t[] = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 };

y -= m < 3;

return (y + y/4 - y/100 + y/400 + t[m-1] + d) % 7;

}

## Monday, May 30, 2011

## Saturday, January 22, 2011

### Doomsday Timeline

by the doomsayers

The Doomsday Algorithm was first introduced in 1973. Over the years, it has undergone many refinements and improvements. The ultimate goal is to make the algorithm easy to calculate mentally in addition to being easy to remember. Here is a timeline of important modifications to the Doomsday algorithm. Please email spectralfft at yahoo.com for corrections/suggestions to this timeline

1882: Christian Zeller devised the Zeller's congruence algorithm for determining the day of the week for any calendar date. This algorithm is not suitable for mental calculation but works well in computer software.

1887: Lewis Carroll published a perpetual calendar algorithm in the journal Nature with the title "To Find the Day of the Week for Any Given Date". Carroll's algorithm can be performed mentally. Lewis Carroll, himself, can calculate the day of the week in about 20 seconds.

1967: Martin Gardner published "Tricks of Lightning Calculators" in the May issue of Scientific American magazine. He gives a full description of Carroll's calendar algorithm.

when?: Martin Gardner told John Horton Conway about Lewis Carroll's perpetual calendar algorithm and challenged him to come up with a better algorithm.

1973: John Horton Conway published the original Doomsday algorithm in the journal Eureka. The title of his paper is "Tomorrow is the Day After Doomsday". Conway reuses Lewis Carroll's formula for calculating doomsyear.

when?: John Horton Conway came up with an improved mnemonic "working 9 to 5 at the 7-Eleven"

when?: John Horton Conway came up with a table-lookup acceleration to calculating the doomsyear term. This method is very fast but it requires the memorization of 18 numbers.

1993: Tomohiko Sakamoto posted a terse C program containing his calendar algorithm in the Usenet newsgroup comp.lang.c . His algorithm and program listing is remarkably simple, but not suitable for mental calculation. Moreover, unlike Zeller's congruence, the Sakamoto algorithm uses table-lookup for each of the 12 months.

1994: Rudy Limeback created a website on the Doomsday algorithm

1995: Sidney Graham created a website on the Doomsday algorithm

2001: Bob Goddard came up with an improved mnemonic -- January 3/4 instead of the original January 31/32

2004: Sohael Babwani published a new algorithm for calculating the day of the week for any calendar date. Like Zeller's congruence, his algorithm is not suitable for mental calculation.

2008: Mike Walters came up with an algorithm to simplify doomsyear term calculation. Bob Goddard later helped him refine this method.

2009: Bob Goddard published the "First Sunday Doomsday Algorithm" which introduced several innovations, including the use of 7's complement in lieu of subtraction/negation

2010: Chamberlain Fong devised the Decade method for calculating doomsyear

2010: Chamberlain Fong and Mike Walters devised the Odd+11 method for calculating doomsyear

2010: Yingking Yu came up with new mnemonics: January 11 and February 22 for leap years. Yingking Yu also made several suggestions to calculating doomsyear.

The Doomsday Algorithm was first introduced in 1973. Over the years, it has undergone many refinements and improvements. The ultimate goal is to make the algorithm easy to calculate mentally in addition to being easy to remember. Here is a timeline of important modifications to the Doomsday algorithm. Please email spectralfft at yahoo.com for corrections/suggestions to this timeline

1882: Christian Zeller devised the Zeller's congruence algorithm for determining the day of the week for any calendar date. This algorithm is not suitable for mental calculation but works well in computer software.

1887: Lewis Carroll published a perpetual calendar algorithm in the journal Nature with the title "To Find the Day of the Week for Any Given Date". Carroll's algorithm can be performed mentally. Lewis Carroll, himself, can calculate the day of the week in about 20 seconds.

1967: Martin Gardner published "Tricks of Lightning Calculators" in the May issue of Scientific American magazine. He gives a full description of Carroll's calendar algorithm.

when?: Martin Gardner told John Horton Conway about Lewis Carroll's perpetual calendar algorithm and challenged him to come up with a better algorithm.

1973: John Horton Conway published the original Doomsday algorithm in the journal Eureka. The title of his paper is "Tomorrow is the Day After Doomsday". Conway reuses Lewis Carroll's formula for calculating doomsyear.

when?: John Horton Conway came up with an improved mnemonic "working 9 to 5 at the 7-Eleven"

when?: John Horton Conway came up with a table-lookup acceleration to calculating the doomsyear term. This method is very fast but it requires the memorization of 18 numbers.

1993: Tomohiko Sakamoto posted a terse C program containing his calendar algorithm in the Usenet newsgroup comp.lang.c . His algorithm and program listing is remarkably simple, but not suitable for mental calculation. Moreover, unlike Zeller's congruence, the Sakamoto algorithm uses table-lookup for each of the 12 months.

1994: Rudy Limeback created a website on the Doomsday algorithm

1995: Sidney Graham created a website on the Doomsday algorithm

2001: Bob Goddard came up with an improved mnemonic -- January 3/4 instead of the original January 31/32

2004: Sohael Babwani published a new algorithm for calculating the day of the week for any calendar date. Like Zeller's congruence, his algorithm is not suitable for mental calculation.

2008: Mike Walters came up with an algorithm to simplify doomsyear term calculation. Bob Goddard later helped him refine this method.

2009: Bob Goddard published the "First Sunday Doomsday Algorithm" which introduced several innovations, including the use of 7's complement in lieu of subtraction/negation

2010: Chamberlain Fong devised the Decade method for calculating doomsyear

2010: Chamberlain Fong and Mike Walters devised the Odd+11 method for calculating doomsyear

2010: Yingking Yu came up with new mnemonics: January 11 and February 22 for leap years. Yingking Yu also made several suggestions to calculating doomsyear.

Subscribe to:
Posts (Atom)