An algorithm to remember and calculate
We know that Mathematics is linked to everything we can see, feel and imagine. Math can help a human build something he has only dreamed of. It has the power to create, modify and destroy things. From the process involved in building computer applications to the preparation of food we eat, all have ‘at least’ a point where Math has to be used. So, here is the bottom line “Can you use Math to improve your social image”? You know the answer is the obvious, yes you can!
The following is the guide to a simple mental calculation (referred from Wikipedia) that will help you easily calculate the day of the week of any date of any year!
Points to be considered:
- The algorithm is valid for the Gregorian calendar. This began in Britain and her colonies on September 14, 1752. The area now forming the United States changed at different times depending on the colonial power; Spain, France, Italy, and others had changed in 1582 and Russia had not changed by 1867 when Alaska was purchased by the U.S. from Russia.
- To know whether a year is a leap year or not, divide the last two digits of the year by 4. If the quotient you get is a whole number like ‘2’, then it’s a leap year. In a special case where the year (all digits) is completely divisible by 100, must also be divisible by 400 in order to qualify as a leap year. If the quotient is a decimal figure like ‘1.25’ it’s a regular year.
- Lets take the year 2008. 08/4 = 2 which means the year 2008 is a leap year. But the year 2100, being completely divisible by 100, must also divisible by 400, which isn’t. So, the year 2100 is not a leap year.
These are the values for the given centuries,months and days:
Centuries table
* 1700-1799 = 4 (Still Julian Calendar in Great Britain and it lands until 1752)
* 1800-1899 = 2
* 1900-1999 = 0
* 2000-2099 = 6
* 2100-2199 = 4
* 2200-2299 = 2
* 2300-2399 = 0
* 2400-2499 = 6
* 2500-2599 = 4
Months table
* January = 0 (in leap year 6)
* February = 3 (in leap year 2)
* March = 3
* April = 6
* May = 1
* June = 4
* July = 6
* August = 2
* September = 5
* October = 0
* November = 3
* December = 5
Days table
* Sunday = 0
* Monday = 1
* Tuesday = 2
* Wednesday = 3
* Thursday = 4
* Friday = 5
* Saturday = 6
Here comes the main part, the calculation:
Let’s use April 24, 1982.
1. Look up the 1900s in the centuries table: 0
2. Note the last two digits of the year: 82
3. Divide the 82 by 4: 82/4 = 20.5 and drop the fractional part: 20
4. Look up April in the months table: 6
5. Add all numbers from steps 1-4 to the day of the month (in this case, 24):
0+82+20+6+24=132.
6. Divide the sum from step 5 by 7 and find the remainder: 132/7=18 remainder 6
7. Find the remainder in the days table: 6=Saturday.
It should be noted that, in this algorithm, the days on which the century, year, and month start are the “zeroth” day. This allows us to add the day of the month directly (without subtracting 1). For example, 1900 starts on day 0 which corresponds to a Sunday; however, we still need to add 1 for the January 1 which brings the day on which January 1, 1900 fell to day 1, which is Monday, the correct day.
So, next time you talk about birthdays with your colleagues, don’t forget to impress them with your new Math Trick 😉
(Errors rectified, as spotted by the readers. Thanks Chirag64!)
Wow. I don’t know if I can remember the trick. 🙂
Hey, this is a nice trick, but its a bit flawed…..1700, 1800 and 1900 weren’t leap years….( refer ur C programs for more info 😛 )
if a year is divisible by 100, then its not a leap year, unless it is also divisible by 400