## Twinkle twinkle little star

Twinkle twinkle little star is a short musical piece I composed and recorded last evening.

This piece consists of 56 measures. It is 1 minute 52 seconds long. The music is composed of four tracks. This is my second attempt at recording music with multiple tracks. The last such attempt was more than two years ago when I composed and recorded 'A few notes'.

The links to the audio files, sheet music, etc. are provided below. The files reside in my website. In case, my website is down, the YouTube link provided below should still work.

The four tracks in this piece are:

1. Grand piano
2. Slow strings
4. Music box

This arrangement is based on the popular melody of the nursery rhyme called Twinkle, twinkle, little star. The melody is played with the treble notes of the piano. I wrote the bass notes for the piano and the strings, and the high notes for the pad and the music box to fill the music with emotions of love and happiness. I recorded this after about two hours of practice.

[music]

## Repeating calendars

A lot of people ask me why I love solving mathematical puzzles. Some ask me how solving puzzles would be useful in my life. The simplest and the only answer I can give is: I enjoy solving puzzles. The concepts learnt while solving a puzzle sometimes turn out to be useful at work or while designing an algorithm. Last night, it helped me earn a pizza for dinner.

A few days back, a friend of mine called me and told me about something that she felt was an interesting thing she had read somewhere. She had read that February 2010 is a special month since each day of the week occurs exactly four times. While I was wondering how obvious this was, she also made the bold claim that this happens only once in 11 years.

I told her that whatever she had read was wrong but she didn't agree. She was ready to bet on it. She was so sure of what she had read that inspite of reminding her that the problem was mathematical and I was better at mathematics than she was, she went ahead with the bet. Of course she lost it and treated me to a pizza shop.

The month of February in any non leap year has 28 days and 28 is a multiple of 7. So, each day would occur exactly 4 times in the month of February of any non leap year. Have a look.

susam@swift:~$paste <(cal feb 2010) <(cal feb 2011) February 2010 February 2011 Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 1 2 3 4 5 7 8 9 10 11 12 13 6 7 8 9 10 11 12 14 15 16 17 18 19 20 13 14 15 16 17 18 19 21 22 23 24 25 26 27 20 21 22 23 24 25 26 28 27 28  A few weeks ago, Prunthaban told me about another variant of this hoax. As per the hoax, February 2010 is special because it starts with a Monday and each day of the week occurs exactly four times. We thought a little over it and found it to be wrong. Here is a counter counterexample: susam@swift:~$ paste <(cal
feb 2010) <(cal feb 2021) <(cal feb 2032)
February 2010           February 2021           February 2032
Su Mo Tu We Th Fr Sa    Su Mo Tu We Th Fr Sa    Su Mo Tu We Th Fr Sa
1  2  3  4  5  6        1  2  3  4  5  6     1  2  3  4  5  6  7
7  8  9 10 11 12 13     7  8  9 10 11 12 13     8  9 10 11 12 13 14
14 15 16 17 18 19 20    14 15 16 17 18 19 20    15 16 17 18 19 20 21
21 22 23 24 25 26 27    21 22 23 24 25 26 27    22 23 24 25 26 27 28
28                      28                      29

February 2032 doesn't start on Monday. This hoax became popular probably because some people found this to hold true for 2021 and they never bothered to check it for 2032.

An interesting question that came to Prunthaban's mind was: Which year will have a calendar which looks exactly like this year's calendar? In other words, after how many years will we have a calendar where the day of week on which each date of the year falls on is exactly equal to the day of the week each date of this year falls on?

We found that after every 28 years the calendars repeat. So, the calendar of 2038 would look exactly like the calendar of 2010. The mathematics behind this is pretty simple.

Each year has 365 days. A leap year has 366 days. Every fourth year is a leap year. Note that the number of years after which the calendar repeats must be a multiple of 4. Let the number of years after which the calendar repeats be p.

If a certain year begins on a particular day and another year begins on the same day, then the number of days between these two years must be a multiple of 7. So, the number of days in these p years must be a multiple of 7.

Now, p must be a multiple of 4. This will ensure that if year x is a leap year if and only if year x + p is a leap year. This condition is necessary because the calendar of a leap year and that of a non leap year can never match. So, let p = 4k, where k is a positive integer.

As per the above discussion, the following must be true:

365 · 3k + 366 · k ≡ 0 (mod 7) ⇒ 1461k ≡ 0 (mod 7)

Now 7 ∤ 1461 and 7 is a prime number. So, 7 must divide k. The smallest positive integer k for which 7 ∣ k is k = 7. So, p = 28.

However, while writing this blog post, I realized that there is a subtle exception. Every fourth year is not really a leap year. A year that is divisible by 100 but not by 400 is not a leap year.

susam@swift:~\$ paste <(cal
feb 1900) <(cal feb 2000) <(cal feb 2100)
February 1900           February 2000           February 2100
Su Mo Tu We Th Fr Sa    Su Mo Tu We Th Fr Sa    Su Mo Tu We Th Fr Sa
1  2  3           1  2  3  4  5        1  2  3  4  5  6
4  5  6  7  8  9 10     6  7  8  9 10 11 12     7  8  9 10 11 12 13
11 12 13 14 15 16 17    13 14 15 16 17 18 19    14 15 16 17 18 19 20
18 19 20 21 22 23 24    20 21 22 23 24 25 26    21 22 23 24 25 26 27
25 26 27 28             27 28 29                28

One can see that 2000 is a leap year while 1900 and 2100 aren't since 1900 as well as 2100 are divisible by 100 but not by 400. So, the calendars of 2100 and 2128 do not match since 2100 is not a leap year while 2128 is.

A more general answer must consider this as well. A fix to the previous solution that works across centuries must have p = 400k. Considering that in a period of 400 years, we have three years that are divisible by 100 but not by 400, we conclude that the number of leap years in a period of 400 years is 97. So,

365 · (400 − 97) · k + 366 · 97k ≡ 0 (mod 7) ⇒ 146097k ≡ 0 (mod 7)

Since, 7 ∣ 146097, the smallest positive integer k for which the above equivalence holds true is k = 1. So, p = 400.

Hence, the calendar repeats every 400 years.