# Taking the Fun Out of Puzzles & Games

## Monday, December 30, 2013

### Mentally calculating the # of Tuesdays between 1700 and 2014

This note explains one way to calculate, in your head, the number of Tuesdays between Jan 1, 1700 and Jan 1, 2014. The overall approach is to calculate how many days there were in the years 1700, 1701, 1702, ..., 2014, and then divide by 7 to get the number of weeks, which gives the number of Tuesdays.

In this note I will talk about some mental tricks/techniques we can use for this, including:

Let's begin. Overall, there are 2014 - 1700 = 314 years from 1700 to 2014. This works out to 365·314 + L days, where L is the number of leap years in that period.

The first step is to multiply 365·314. We can simplify this with some basic algebra, by noting that (a+b)(a+c) = a(a + b + c) + bc. Letting a = 300, b = 65, and c = 14, we have: 365·314 = (300 + 65)(300 + 14) = 300(300 + 65 + 14) + (65·14)
= 300·379 + 65·14.

300·379 isn't too bad to do in your head; it's 900 + 210 + 27 = 1137, and then adding two zeros gives 113700. We will need to remember this number for later. Using the mnemonic major system we can remember the first four digits 1137 as "toot mic" (picture someone blowing a horn into a microphone).

Now for 65·14. By writing this as 66·14 - 14, we can use the algebra from above and set a = (66+14)/2 = 40, b = 26, and c = -26, which gives us 66·14 = (40 + 26)(40 - 26) = 402 - 262, a difference of two squares. There are many tricks for doing squares.  One is that ab^2 = 100a2 + 10·2ab + b2, so 262 = 100·4 + 10·24 + 36 = 400 + 240 + 36 = 676, so 402 - 262 works out to 1600-676. It is often simpler to calculate x - y by converting it to x + ~y, where ~y is the "second complement" of y. Here the second complement of 676 is 324 - 1000, so we have 1600 - 676 = 1600 + (324 - 1000) = 600 + 324  = 924. Finally we subtract 14 to get 65·14 = 910, which we can remember as "pots".

Now we need to add the last two steps, "toot mic" (113700) and "pots"(910); the sum is 114610, which we can remember as "toot reach toes" (a trumpeter playing a note with the trumpet reaching down to his toes).

We can check the arithmetic by casting out 11s. To do this we first calculate the value of each number mod 11:

365 = 5 + 3 - 6 = 2 (mod 11)
314 = 4 + 3 - 1 = 6 (mod 11)
114610 = 0 + 6 + 1 - (1 + 4 + 1) = 7 - 6 = 1 (mod 11)

Then we re-do our original problem of 365·314 using the mod 11 values and make sure the answer is correct:

365·314 = 2·6 = 12 = 1 = 114610 (mod 11)

They are equal, so that checks out.

Now, how many leap years were there in that period? My rule for leap years is this:
If the last two digits of the year are 00, throw them away and keep only the first two digits. Otherwise, keep just the last two digits. Then the year is a leap year just when what remains is divisible by 4.
We can use this rule to figure out that there are 24 leap years in each of the 1700s, 1800s, and 1900s, for a total of 72 leap years in 1700, 1701, 1702, ... 1999. Furthermore, 2000, 2004, 2008, and 2012 were leap years, so in total there were 76 leap years in the 314-year period from Jan 1, 1700 through Jan 1, 2014.

Our total so far is 114610, "toot reach toes". Adding on 76 days (1 for each leap year) yields 114686, "toot reach fish" (a trumpeter playing for some fishes in the water).

According to the First Sunday Doomsday Algorithm, Dec 31, 2014 was a Tuesday, so we need to be sure to include that day in the calculation. In order to make the total number of days equal to an integer number of weeks, we need to end on a Thursday, so we add 2 more days to end on Thursday, Jan 2, 2014. This yields a total of 114688 days, which we can remember as "toot reach fife" (a trumpeter playing up to a fife on a shelf).

If the above arithmetic is correct, 114688 will equal an integer number of weeks; that is, it will be divisible by 7. It's easy to test for divisibility by 2 or 5, but 7 is a bit trickier. Wikipedia gives a fast method called Pohlman-Mass test for divisibility by 7, which I haven't seen described anywhere else. According to this method, 7 divides 114688 just when 7 divides (114688 - 114114) = 574. And 7 divides 574 just when 7 divides 57 - 4·2 = 49. And since 7 divides 49, 7 also divides 114688, which is consistent with the previous arithmetic being correct.

Actually carrying out the division mentally, which is kind of a pain, we find that 114688/7 = 16384. It just so happens that this is 214, and so there are 214 Tuesdays between Friday, Jan 1, 1700 and Jan 1, 2014.