Date: Wed, 17 Jun 1998 02:20:15 0400
From: Roger C. Evans
If I later recall in what text I encountered the working out of the dayofweekfromdate problem I'll send the reference on (possibly Oystein Ore's "Number Theory and Its History"?). In any case, the following computation will allow you to reconstruct tables for your memory trick (that'll work for any dates in the Gregorian calendar):
USING THESE CONVENTIONS:

 for a realdate = (month, day, year): IF month is NOT Jan. or Feb., let the "workingdate" be the realdate; OTHERWISE, let workingdate be (month, day, year1). Identify the workingdate as the number triplet (M, D, Y), where M = 1, ... ,12 for March, ... , December, Jan, and Feb. respectively (note the cyclic shift!) and D = the day number in the month. Represent year Y by Y1 and Y2, given respectively by first and last two digits of Y (thus Y = 1941 > Y1 = 19, and Y2 = 41).
 G(x) = "greatest integer in x";
thus G(10.3) = 10 = G(10).
 Q(m;n) = "quotient m over n" = G(m/n);
thus Q(18;4) = G(4.5) = 4.
 R(m;n) = "remainder m over n" = m  n*Q(m;n);
thus R(39;7) = 39  7*5 = 4.
THE RESULT IS A "MOD 7" CALCULATION:

Set X = 2*M + D + 5*Y1 + Y2 + Q(3*M1;5) + Q(Y1;4) + Q(y2:4).
Then ANS = R(X;7),

where

0 >Sunday; 1 >Monday; ...; and 7 >Saturday.

EXAMPLES:

 Real date (Dec. 7, 1941) > (M, D, Y1, Y2) = (10, 7, 19, 41)
so
X = 2*M + D + 5*Y1 + Y2 + Q(3*M1;5) + Q(Y1;4) + Q(y2:4)
= 20 + 7 + 95 + 41 + 5 + 4 + 10 = 182.ANS = R(182;7) = 0 > Sunday.
 One may of course work mod 7 throughout:
Real date (Jan. 1, 2000) > working date (Jan. 1. 2000) >
(M, D, Y1, Y2) = (11, 1, 19, 99)
so
X = 2*M + D + 5*Y1 + Y2 + Q(3*M1;5) + Q(Y1;4) + Q(y2:4)
= 1 + 1 + 4 + 1 + 6 + 4 + 3
= 6 > Saturday.
70538548