in reply to How preparing the weekly shift roster led to a fascinating discovery...
You don't have to test all years, nor 400 years, not even 14 years or 7!
Considering just one year (any year you wish) is enough.
This might seem surprising, but it really isn't. As long as you don't start your year on the 1st of January, but on the 1st of March.
Suppose, the 1st of March is a Monday then:
Because of leap years the last day of January can at the most shift one day, but as it is on the "+0" spot, it can never make it to the "+3" spot, hence "day +3" is always missing for the 31st.
QED
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How preparing the weekly shift roster led to a fascinating discovery...
by lidden (Curate) on Dec 14, 2007 at 22:31 UTC | |
by CountZero (Bishop) on Dec 15, 2007 at 07:34 UTC | |
|
Re^2: How preparing the weekly shift roster led to a fascinating discovery...
by McDarren (Abbot) on Dec 15, 2007 at 04:13 UTC | |
by CountZero (Bishop) on Dec 15, 2007 at 09:10 UTC | |
by polettix (Vicar) on Dec 15, 2007 at 15:22 UTC |