How to determine the day of the week by date without looking at the calendar
How to determine the day of the week by date without looking at the calendar
Anonim

It is not necessary to be a genius or clairvoyant to determine the day of the week for any date without the help of a calendar. It is enough to memorize a couple of formulas. At the same time, this exercise can be a good workout for the mind and memory.

How to determine the day of the week by date without looking at the calendar
How to determine the day of the week by date without looking at the calendar

To determine the day of the week by date, you need to use the formula:

day of week = (day + month code + year code)% 7

Explanations

Month code

Month and year codes are perhaps the hardest part of the formula.

You just need to remember the month code.

  • 1 - January, October;
  • 2 - May;
  • 3 - August;
  • 4 - February, March, November;
  • 5 - June;
  • 6 - December, September;
  • 0 - April, July.

The easiest way to remember such illogical data is to use associations.

Year code

The year code in the XXI century is calculated using the formula:

year code = (6 + last two digits of the year + last two digits of the year / 4)% 7

The "/" operator means incomplete quotient, that is, the whole part of the result of division.

  • 2015: (6 + 15 + 15/4)% 7 = (6 + 15 + 3)% 7 = 24% 7 = 4;
  • 2016: (6 + 16 + 16/4)% 7 = (6 + 16 + 4)% 7 = 26% 7 = 5;
  • 2017: (6 + 17 + 17/4)% 7 = (6 + 17 + 4)% 7 = 27% 7 = 6;
  • 2026: (6 + 26 + 26/4)% 7 = (6 + 26 + 6)% 7 = 38% 7 = 3.

If you want to know the day of the week for the date of another century, you will also have to take into account the values of the century (6, 4, 2, 0). Instead of 6 for the next centuries, the following values will be:

  • 16xx: 6;
  • 17xx: 4;
  • 18xx: 2;
  • 19xx: 0;
  • 20xx: 6;
  • 21xx: 4 and so on.

% 7

It's simple here:% is the remainder operator for division.

Decoding the result

Countdown start - weekend, that is: 0 - Saturday, 1 - Sunday, and so on.

Calculation examples

  • July 25, 2016: (25 + 0 + 5)% 7 = 30% 7 = 2 - Monday;
  • August 8, 2017: (8 + 3 + 6)% 7 = 17% 7 = 3 - Tuesday;
  • January 5, 2127:

    • (4 + 27 + 27/4)% 7 = (4 + 27 + 3)% 7 = 34% 7 = 6 - year code;
    • (5 + 1 + 6)% 7 = 10% 7 = 5 - Thursday.

Of course, calculating the day of the week by date in your head is not a vital skill in the technology age. But this is a non-trivial exercise for everyone who loves to develop their memory and perform operations with numbers.

UPD. Unfortunately, this formula does not work well for leap years. Until February 29 inclusive, you will have to add one more unit to the formula to get the correct day. Thanks to the readers for finding a bug.

Recommended: