2005

DEADBEAT PAYING JOB • chapter 104

 

pst

mon
feb
21

Let's face it: If all the years had 364 days, which is evenly divisible by 7, the years 1900, 1901, 1902, 1903, and 1904 would simply follow the same pattern, and we wouldn't have to figure anything else out.

However, 1900, 1901, 1902 and 1903 all have 365 days, and if you tack the leap day from 1904 back onto the end of 1903, pretending the New Year won't start until March 25th, 1903 will actually have 366 days. This means, by the time you get to March 1904, the overall displacement from the modulo-7 grid will be a grand total of 1+1+1+2 = 5 days.

1900 has 364+1 days, 1901 has 364+1 days, 1902 has 364+1 days, and 1903 has 364+1 days, plus the leap day snatched from 1904, for a total of 5 off the mark.

Many weekday algorithms simply take the last two digits of the year and add it to a quarter of that number, rounded down, and stop there. That is, for 1901, add 1; for 1902, add 2; for 1903, add 3; and for 1904, add 5, (4 plus a quarter of 4), these being the individual adjustments needed for those years.

However, notice that whenever we need to adjust forward by 5, this is the same thing as adjusting backward by 7 - 5 = 2! This can make adjustments much easier. Instead of adjusting 1904 by 5, 1908 by 10, 1912 by 15, 1916 by 20, ..., we can adjust backward for those years! Thus, 1904 by -2, 1908 by -4, 1912 by -6, 1916 by -8, ..., a calculation so much easier.

If you want to look at this in a more tangible way, simply examine April in the calendar years 1900, 1904, 1908 and 1912 and see what adjustment is necessary, to get the entire year back onto the modulo-7 grid.

pm
7:27

 

 

April 1900

 

S

M

T

W

T

F

S

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

 

 

 

 

 

 

year adjustment = 0

 

April 1904

 

S

M

T

W

T

F

S

 

 

 

 

 

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

 

year adjustment = -2

 
 

 

 

April 1908

 

S

M

T

W

T

F

S

 

 

 

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

 

 

 

year adjustment = -4

 

April 1912

 

S

M

T

W

T

F

S

 

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

 

 

 

 

 

year adjustment = -6

 
 

 

 

So here's the Overview: We want to determine the day of the week for any month, day and year, in the Gregorian calendar, as established by law in the British Colonies, beginning September 14, 1752.

If we can get any particular day to conform to the identical modulo-7 grid as April in the year 1900, we can always calculate the weekday by dividing by 7 and keeping the remainder, with 1=sun, 2=mon, 3=tue, 4=wed, 5=thu, 6=fri and 0=sat.

And here's the Floor Manager's point of view: In the year 1900, we can always accomplish this by adding the month code to the day of the month, then dividing by 7.

In the years 1904, 1908, 1912, 1916, 1920, ..., we can always accomplish the same thing as in 1900, by subtracting half the last two digits of the year from the month code plus the day of the month, before dividing by 7 to find the remainder.

 

 

 

 

Finally, there's a technical note: Subtracting, modulo 7, is the same thing as counting UP to the next highest integer evenly divisible by 7.

Thus, X / 7, find the remainder, is seeing how far DOWN you have to go to reach an even multiple of 7; whereas, (- X) / 7, find the remainder, is seeing how far UP you have to go to reach an even multiple of 7.

Or something like that.

8:17

 
 

home < < earlier

 < • > 

> > > chapter 105