Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What day of the week was Sep. 23 1959?

39 views
Skip to first unread message

JohnL

unread,
May 15, 2001, 6:38:49 PM5/15/01
to
I came across an interesting article in today's paper about dinner parties.
It ended with this:

Suppose the date is September 23, 1959. First, take the final two digits of
the year (in this case, 59), divide them by four, ignoring any remainder
(14), and add the result to the original two digits (giving 73). Now add to
this the day of the month (23) and divide the result by seven, this time
keeping only the remainder (five).

Next, add the "month number": six for January (five in leap years), two for
February (one in leap years); two for March; five for April; zero for May;
three for June; five for July; one for August; four for September; six for
October; two for November; four for December. Finally, add two and divide
the result by seven, again keeping only the remainder. The result is the day
of the week on which you were born, starting from one for Sunday. So
September 23, 1959, was a Wednesday.

It is originally from the Sunday Telegraph and written by Robert Matthews
and titled "For the perfect party, invite a mathematician". The article can
be found here
http://www.telegraph.co.uk/et?ac=005013993414605&rtmo=V1ljk4Zx&atmo=99999999
&pg=/et/01/1/4/ecfmath04.html

I've noticed that it doesn't work for years after 2000, but it will if you
subtract 1 on the next to last step. i.e. today is 2001 May 15, I get the
number 4 which makes today Wednesday....but if I take away 1 it works and
today is Tuesday.

I think it's pretty interesting BUT how does it work? AND what's the deal
with the "month number"? I've taken a couple of stabs at it and haven't
really got anywhere.
Any insight would be great

Thanks
John

Doug Magnoli

unread,
May 16, 2001, 3:25:49 AM5/16/01
to
I saved two posts on this topic a year or so ago.  They follow.

-Doug Magnoli
 

From - Thu Sep 21 23:55:01 2000
Path: news1.frmt1.sfba.home.com!newshub2.rdc1.sfba.home.com!news.home.com!news-peer.gip.net!news.gsl.net!gip.net!howland.erols.net!news.alt.net!oz.net!usenet
From: Barry Schwarz <schw...@deloz.net>
Newsgroups: alt.math.recreational
Subject: Re: What day of the week is it for a particular date?
Date: 11 Sep 2000 06:10:35 GMT
Lines: 50
Message-ID: <8pht0r$ue0$0...@216.39.130.83>
References: <jrdnrsk3a079ui80t...@4ax.com>
NNTP-Posting-Host: 216.39.130.83
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Newsreader: Forte Agent 1.8/32.548
Xref: newshub2.rdc1.sfba.home.com alt.math.recreational:30016164

On Sun, 10 Sep 2000 16:40:33 GMT, LT
<lynne....@notneeded.ns.sympatico.ca> wrote:

>Could anyone explain why this works -  What day of the week is July
>20, 1969 etc.?
>Soln. Step1. Count days from Jan 1 to July 20 = 201
>Step 2. Subtract 1 from the year 1969-1 = 1968 and divide by 4 which
>equals 492 (omitting any remainder)
>Step 3. Add the original year (1969) to the number of days 201 and 492
>= 2662
>Step 4. Subtract 2 from 2662 and divide the result 2660 by 7. The
>remainder will tell you the day of the week with Sun. as 0, Mon. as 1,
>etc. The remainder is 0 in this case so July 20, 1969 was a Sunday.
The procedure is based on the fact that a 365 day year is exactly one
day more that 52 weeks.

The division by 4 allows the formula to account for the fact that a
leap year throws one additional day into the equation.

If you know the starting day for any year, then you easily determine
the starting day for a subsequent year simply by adding one for each
year plus one for each leap year.

Once you know the starting day for the year, the day of the week for a
date expressed as yyyyddd is determined solely by the ddd.  Expressed
this way you don't have to be concerned about leap years; you don't
care whether day 61 is March 1 or 2 since it is still day 61.  I guess
a better way to phrase it is the user has already taken leap year or
not into account when he determined it was day 61.

This explains all the terms except for the minus 2.  Plug in a known
date (today, Sunday, Sep 10, 2000) without the -2 and you get a value
of 2.  We could count the week from 0 to 6 as Friday to Thursday but
that is not popular.  Adding the -2 to the process creates a constant
bias that allows 0 to 6 to represent Sunday to Saturday.

The formula has an error in the computation of the number of leap
years.  It assumes every fourth year is a leap year but 1900, 2100,
etc., are not leap years.  This error is silently compensated for in
the bias described above.  Therefore, the procedure is only valid from
Jan 1, 1901 to December 31, 2100.  (The procedure claims December 31,
1900 is Sunday when it is Monday.  Similarly, it claims January 1,
2101 is Sunday when it is Saturday.)

This error could be corrected adding a term related to year/400 or
possibly (year-1)/400 and then adjusting the bias to get a remainder
of 0 to match up with Sunday again.

***************************
 

From - Fri Feb 18 06:19:35 2000
Path: news1.frmt1.sfba.home.com!newshub1.home.com!news.home.com!newsfeed.direct.ca!torn!watserv3.uwaterloo.ca!alopez-o
From: alop...@neumann.uwaterloo.ca (Alex Lopez-Ortiz)
Newsgroups: sci.math,news.answers,sci.answers
Subject: sci.math FAQ: dayofweek
Followup-To: sci.math
Date: 17 Feb 2000 22:55:53 GMT
Organization: University of Waterloo
Lines: 145
Approved: news-answe...@MIT.Edu
Expires: Sun, 1 Mar 1998 09:55:55
Message-ID: <88hu9p$r60$1...@watserv3.uwaterloo.ca>
Reply-To: alop...@neumann.uwaterloo.ca
NNTP-Posting-Host: daisy.uwaterloo.ca
Summary: Part 26 of 31, New version
Originator: alop...@neumann.uwaterloo.ca
Originator: alop...@daisy.uwaterloo.ca
Xref: newshub1.home.com sci.math:30136677 news.answers:30062566 sci.answers:30004069
 

Archive-name: sci-math-faq/dayofweek
Last-modified: February 20, 1998
Version: 7.5

 
      How to determine the day of the week, given the month, day and year
 
   First a brief explanation: In the Gregorian Calendar, over a period of
   four hundred years, there are 97 leap years and 303 normal years. Each
   normal year, the day of January 1 advances by one; for each leap year
   it advances by two.
 
   303 + 97 + 97 = 497 = 7 * 71
 
   As a result, January 1 year N occurs on the same day of the week as
   January 1 year N + 400. Because the leap year pattern also recurs with
   a four hundred year cycle, a simple table of four hundred elements,
   and single modulus, suffices to determine the day of the week (in the
   Gregorian Calendar), and does it much faster than all the other
   algorithms proposed. Also, each element takes (in principle) only
   three bits; the entire table thus takes only 1200 bits; on many
   computers this will be less than the instructions to do all the
   complicated calculations proposed for the other algorithms.
 
   Incidental note: Because 7 does not divide 400, January 1 occurs more
   frequently on some days than others! Trick your friends! In a cycle of
   400 years, January 1 and March 1 occur on the following days with the
   following frequencies:
 
           Sun      Mon     Tue     Wed     Thu     Fri     Sat
    Jan 1: 58       56      58      57      57      58      56
    Mar 1: 58       56      58      56      58      57      57

   Of interest is that (contrary to most initial guesses) the occurrence
   is not maximally flat.
 
   In the Mathematical Gazette, vol. 53,, pp.127-129, it is shown that
   the 13th of the month is more likely to be a Friday than any other
   day.The author is a 13 year old S.R.Baxter.
 
   The Gregorian calendar was introduced in 1582 in parts of Europe; it
   was adopted in 1752 in Great Britain and its colonies, and on various
   dates in other countries. It replaced the Julian Calendar which has a
   four-year cycle of leap years; after four years January 1 has advanced
   by five days. Since 5 is relatively prime to 7, a table of 4 * 7 = 28
   elements is necessary for the Julian Calendar.
 
   There is still a 3 day over 10,000 years error which the Gregorian
   calendar does not take into account. At some time such a correction
   will have to be done but your software will probably not last that
   long!
 
   Here is a standard method suitable for mental computation:
 
    1. Take the last two digits of the year.
    2. Divide by 4, discarding any fraction.
    3. Add the day of the month.
    4. Add the month's key value: JFM AMJ JAS OND 144 025 036 146
    5. Subtract 1 for January or February of a leap year.
    6. For a Gregorian date, add 0 for 1900's, 6 for 2000's, 4 for
       1700's, 2 for 1800's; for other years, add or subtract multiples
       of 400.
    7. For a Julian date, add 1 for 1700's, and 1 for every additional
       century you go back.
    8. Add the last two digits of the year.
    9. Divide by 7 and take the remainder.
 
   Now 1 is Sunday, the first day of the week, 2 is Monday, and so on.
 
   The following formula, which is for the Gregorian calendar only, may
   be more convenient for computer programming. Note that in some
   programming languages the remainder operation can yield a negative
   result if given a negative operand, so mod 7 may not translate to a
   simple remainder.
 
   W = (k + floor(2.6m - 0.2) - 2C + Y + floor(Y/4) + floor(C/4)) mod 7
 
   where floor() denotes the integer floor function,
   k is day (1 to 31)
   m is month (1 = March, ..., 10 = December, 11 = Jan, 12 = Feb) Treat
   Jan & Feb as months of the preceding year
   C is century (1987 has C = 19)
   Y is year (1987 has Y = 87 except Y = 86 for Jan & Feb)
   W is week day (0 = Sunday, ..., 6 = Saturday)
 
   Here the century and 400 year corrections are built into the formula.
   The floor(2.6m - 0.2) term relates to the repetitive pattern that the
   30-day months show when March is taken as the first month.
 
   The following short C program works for a restricted range, it returns
   0 for Monday, 1 for Tuesday, etc.
 
dow(m,d,y){y-=m<3;return(y+y/4-y/100+y/400+"-bed=pen+mad."[m]+d)%7;}

   The program appeared was posted by saka...@sm.sony.co.jp (Tomohiko
   Sakamoto) on comp.lang.c on March 10th, 1993.
 
   A good mnemonic rule to help on the computation of the day of the week
   is as follows. In any given year the following days come on the same
   day of the week:
 
4/4
6/6
8/8
10/10
12/12

   to remember the next four, remember that I work from 9-5 at a 7-11 so
 
9/5
5/9
7/11
11/7

   and the last day of Feb.
 
   "In 1995 they come on Tuesday. Every year this advances one other than
   leap-years which advance 2. Therefore for 1996 the day will be
   Thursday, and for 1997 it will be Friday. Therefore ordinarily every 4
   years it advances 5 days. There is a minor correction for the century
   since the century is a leap year iff the century is divisible by 4.
   Therefore 2000 is a leap year, but 1900, 1800, and 1700 were not."
 
   Even ignoring the pattern over for a period of years this is still
   useful since you can generally figure out what day of the week a given
   date is on faster than someone else can look it up with a calender if
   the calender is not right there. (A useful skill that.)
 
      References
 
   Winning Ways for your mathematical plays. Elwyn R. Berlekamp, John H.
   Conway, and Richard K. Guy London ; Toronto : Academic Press, 1982.
 
   Mathematical Carnival. Martin Gardner. New York : Knopf, c1975.
 
   Elementary Number Theory and its applications. Kenneth Rosen. Reading,
   Mass. ; Don Mills, Ont. : Addison-Wesley Pub. Co., c1993. p. 156.
 
   Michael Keith and Tom Craver. The Ultimate Perpetual Calendar? Journal
   of Recreational Mathematics, 22:4, pp. 280-282, 19
--
Alex Lopez-Ortiz                                         alop...@unb.ca
http://www.cs.unb.ca/~alopez-o                       Assistant Professor
Faculty of Computer Science                  University of New Brunswick

JohnL

unread,
May 16, 2001, 10:02:18 AM5/16/01
to
Thanks Doug!!!

Hermann Kremer

unread,
May 16, 2001, 2:18:41 PM5/16/01
to

JohnL schrieb in Nachricht ...
[ ... ]

Hi,
if you are programming in C, here is a short program implementing a
Day_of_Week algorithm. It's from http://www.snippets.org

Regards
Hermann

-------------------------------------

/* +++Date last modified: 05-Jul-1997 */
/*
** DOW.C
**
** Public domain by VinhHao Nguyen, 03/94
**
*/

#define ADJ 5 /* ISO_CALENDAR monday == 0 */
//#define ADJ 6 /* TRADITIONAL sunday == 0 */

unsigned DOW(unsigned y, unsigned m, unsigned d)
{
if (m < 3)
{
m += 13;
y--;
}
else m++;
return (d + 26 * m / 10 + y + y / 4 - y / 100 + y / 400 + ADJ) % 7;
}

#ifdef TEST

#include <stdio.h>
#include <stdlib.h>

main(int argc, char *argv[])
{
int Day;
void usage(void);
unsigned d, m, y, days[] = {31, 29, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31};
char *day[2][7] = {
{"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"},
{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}
};
char *month[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec",};


if (4 > argc)
usage();
y = atoi(argv[1]);
m = atoi(argv[2]);
d = atoi(argv[3]);
if (!m || m > 12)
usage();
if (!d || d > days[m - 1])
usage();
if (y < 100)
y += 1900;
Day = DOW(y, m, d);
printf("DOW(%s) returned %d, so %d %s %d is a %s\n",
ADJ==5 ? "ISO" : "NON-ISO",
Day, d, month[m - 1], y, day[ADJ - 5][Day]);
return 0;
}

void usage(void)
{
puts("Usage: DOW yy[yy] mm dd");
exit(-1);
}

#endif /* TEST */


Robert H Stewart

unread,
May 17, 2001, 7:50:47 PM5/17/01
to
<lynne....@notneeded.ns.sympatico.ca> wrote:

>Could anyone explain why this works - What day of the week is July
>20, 1969 etc.?

Martin Gardner, in his paperback, "Mathematical Carnival", has several
pages on this subject. He gives a history of calendars and also confirms
your idea (quote: For the 2000's go one day back). He also gives the
following
table to remember the key numbers for the months.

144 (Jan, Feb, Mar)
025 (Apr, May, June)
036 (Jul, Aug, Sept)
146 (Oct, Nov, Dec)

Note that the first three triplets are the squares of 12, 5, and 6, and that
the last
triplet, 146, is just 2 more than the first square.

Happy MATH GranP...@prodigy.net

Kamil Zdankowski

unread,
May 28, 2001, 11:40:27 AM5/28/01
to
it was a wednesday took a LONG time counting backwards JK

"Robert H Stewart" <GRANP...@prodigy.net> wrote in message
news:9e1o6b$213q$1...@newssvr05-en0.news.prodigy.com...

0 new messages