Page 1 of 1

Course - Mental Calculation of the Calendar

Posted: Fri Sep 30, 2016 8:53 pm
by ~
Week 1 - Calculating the Calendar Mentally. Learning the Sequence of Days 1 to 31.

This is a short course about an algorithm to calculate the calendar using only simple arithmetic mental calculations.

Currently there's only 1 video for Week 1, but it should give enough time to understand each part of the course in a fine-grained manner.

The algorithm is very lightweight so it is suitable to allow for mental usage and calculations with it, so it should also be extremely simple, optimized and lightweight if used to implement a date managing application, for example in an open source BIOS or in a kernel.

It isn't about calculating a timestamp but the actual day numbers 1-31 and its corresponding weekday names.
Calculating the Calendar Mentally.
Learning the Sequence of Days 1 to 31.


The first thing we need to learn to mentally calculate the calendar is learning the sequence of the days in vertical order. It will allow us to reach all weeks of the month fast for any day, will also allow us to obtain all the day numbers for every weekday.

The only other thing that we must never forget is the weekday name in which the month starts, and also the number of days in that month. We simply must memorize that, and normally it's enough to memorize it for the current month. Over time it will become more routinary to remember those details.

We have months with 28, 29, 30 and 31 days, but if we learn the sequence for 31 days we can calculate any day of shorter months.

The following is the verbal sequence we need to learn. A single line is the sequence for a single weekday. The month can start at any day, so the sequence for day 1 or the rest of these sequences can fall at any weekday name:

1, 8, 15, 22, 29.
2, 9, 16, 23, 30.
3, 10, 17, 24, 31.
4, 11, 18, 25.
5, 12, 19, 26.
6, 13, 20, 27.
7, 14, 21, 28.

Just memorize the previous numbers and see if you can then inspect the calendar for the current month and match this sequence with the sequence for the actual month that you are interested in. There are only 7 weekdays so this list can only start in 7 different ways, but this same sequence is used for all 7 combinations.

Now see if you can determine the first day of the week without looking at the calendar as well as the last day. Practice with other days as you need them.


Determining the Last Day.

We have months with 28, 29, 30 and 31 days.
28-day months end the weekday before they started.
29-day months end the same weekday in which they started.
30-day months end the next weekday from which they started.
31-day months end two weekdays after the one in which they started.

The first day of the following month is simply the very next weekday for any of the last weekdays we just described.

Now see if you can calculate the last weekday for this month and then the first weekday for the next month by advancing to the following weekday.

Now also try to calculate the weekday of several birthdays or deadline weekdays for when you need to finish or pay something. Also try to calculate the weekdays for the next Saturday and Sunday.

Course - Mental Calculation of the Calendar (Week 2)

Posted: Fri Oct 07, 2016 10:15 pm
by ~
Week 2 - Calculating the Calendar Mentally. Calculating Freely for Any Month.

We must remember the first weekday of the year, whether it's a leap year, and the following sequence of numbers below. If it isn't a leap year, we must calculate the sequence normally and then substract 1, and it applies from February.

This sequence applies with 0 for January since it's the starting point, and then from February to the first day of the next year.

To manually know whether this is a leap year, we simply need to see if February is 29 days long. If it only has 28 days, then it isn't a leap year.

Also in general, if this year is exactly divisible by 4, then it's a leap year. It might be that it doesn't apply for all existing years, but it's the minimum consideration that we can determine calculating only mentally in a simple way.

We must learn the following sequence of numbers for being able to calculate the initial day of any month. Each one of these numbers corresponds to each one of the months of the year, from January to December, and the last individual number corresponds to the first day of the next year.

0, 3, 5, 1.
3, 6, 1, 4.
7, 2, 5, 7.
3.

Examples of leap years are 2000, 2004, 2008, etc.

We could learn:
- The number of a specific special year. For example 1984.
- The first weekday of that year. Sunday in this case.
- And whether it's a leap year or not. In this case it is.

Just with that and with our techniques so far, we can now calculate any day of that year.



Now try to determine the first day of November 2016 and November 2 2016. 2016 started in Friday, it's a leap year because February has 29 days. 2016 is divisible exactly by 4.

For November it corresponds to us to advance 5 days and since it's a leap year we have to advance those 5 days instead of 4 days, to reflect that February 29 is present. So, since we started the first day of the year in:

Friday.

If we now advance 5 days, starting from the initial weekday of the year, we have:

Friday, Saturday, Sunday, Monday, Tuesday.

So November 1 2016 falls in Tuesday, and obviously November 2 falls in Wednesday.

Re: Course - Mental Calculation of the Calendar

Posted: Sat Oct 08, 2016 12:43 am
by iansjack
Is this a joke, or just an insult to our intelligence?

Whatever, it is not an Announcement, Test Request, or Job Opening.

Re: Course - Mental Calculation of the Calendar

Posted: Sat Oct 08, 2016 2:08 am
by MichaelFarthing
Well I was taught a method for doing it for any date of any year of any century in the Gregorian calendar and it took a 5 minute interlude in the middle of a Maths lecture in 1972. I've used it ever since. The method in this thread looks far too complicated for me. But then - the man that taught me also invented Life!

Re: Course - Mental Calculation of the Calendar

Posted: Sat Oct 08, 2016 3:54 am
by thepowersgang
I have to agree with @iansjack - this is off-topic both for this forum, and for the entire site. Locking thread.