Disclaimer:
Permission to use, copy,
and distribute this software and
It’s documentation for any non commercial purpose is hereby granted without fee,
provided:
THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO
EVENT SHALL Henrik Vestermark, BE LIABLE FOR ANY
SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY
OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

Practice mental Day of the week calculation

Mental calculation of the week day of the week for any dates

Using the technic describe below can be used as a good party trick or just a way to stimulate and keep your brain sharp. On the internet you can find several methods describe different way of achieving the same answer for the day of the week. I personally find below methods the easiest way of doing it and the fastest to learn. I first came across this method via Arthur Benjamin (https://www.math.hmc.edu/~benjamin/ ) who is the wizard of mental math calculation and can be found on Youtube or ?The secrets of Mental Math? on www.TheGreattCourses.com The only math you need to know is to be quick in adding 1 or 2 digits number together, memorize months and century offset and also be quick in taking a number modulus 7. (calculating the remainder of dividing by 7, for shorthand we will use the C language operator for modulus %).
The technic is simple and straightforward for a given day in the format DD/MM/YYYY.
Start with the year (YYYY) and for simplicity we split up the year in a 2-digit century and 2-digit year within the century. E.g. CCYY.

We start with the YY and do nothing other that remember the year. This is known to be the year offset. YY

Next, we find how many leap years we have experience so far in this century by dividing the year with 4 and take the whole number the year divide up in 4 and add it to the number from step 1. ?E.g. For year 58 you get 58/4=14

Next you add the century offset to number. Here you must memorize a few number. For the 19th hundred it is 0, for the 18th century it is 2, for the 17th century it is 4 and for the 16th century it is 6 and then the number sequence repeat itself both up and down.

Century

16th

17th

18th

19th

20th

21th

22th

23th

Offset

6

4

2

0

6

4

2

0

Next step is to add the Months offset and here we need to memorize a few more numbers.

Months

Jan

Feb

Mar

Apr

May

Jun

Jul

Aug

Sep

Oct

Nov

Dec

Offset

1

4

4

0

2

5

0

3

6

1

4

6

Remember

122

52

62

122+

Arthur Benjamin cleverly suggested for each quarter, 12 square, 5 square, 6 square and a little bit more than 12 square to remember the offset and it actually works out great. Easy to remember and easy to calculate. E.g. The months of September has an offset of 6 while month of April has an offset of 0.

Next step is to add a possible leap year offset only valid for the first wo months (Jan and Feb). The offset is a fix constant of -1 otherwise 0 if the months are from Mar-Dec

Lastly, we add the day of the months DD to our result.

We take all the offset we have added from step 1 to step 6 and find the remainder after dividing it by 7. The result is a number between 0 and 6 and the day of the week is as follows.

Result modulus 7

Day of the Week

0

Saturday

1

Sunday

2

Monday

3

Tuesday

4

Wednesday

5

Thursday

6

Friday

Lets see how it works on a real example of lets say September 4, 1957, 22 February 2004 and of course Albert Einstein birthday 14 March 1879?

As always you need to practice mastering the mental calculations and the practice calculator above will help you quickly obtain your skills to do it fast and accurately. There are some short cuts you can apply along the way. E.g. you don?t need to wait until all the digits has been calculated and added together to do you modules 7 calculation. You can do it along where it makes sense. E.g. Albert Einstein?s birthday 14/03/1879. Notice that after the first 2 offsets the result is 0 meaning we can forget the YY and number of leap year calculation to free up your brain to do the remaining calculation. I usually apply this short cut only to the first two offsets calculated to reduce the accumulated number. The accumulated of the other offsets will be less than 43. Making it faster to do the modulus 7 calculation of the total sum at the end.

Offset

14/03/1879

Accumulator

Year offset YY

79

79%7=2

Number of leap year (YY/4)

19

(2+19)%7=0

Century offset (CC)

2

2%7=2

Months offset (MM)

4

(2+4)%7=6

Leap year month offset

0

(6+0)%7=6

Day in Months (DD)

14

(6+14)%7=6

Total

118

6

Result modules 7

6=Friday

6=Friday

Have fun

Corrections:

28-Dec-2017

Vs 1.1

Improve description of method used and minor bugs

21-Jun-2017

Vs 1.0

Initial release of practice mental day of the week calculation