A calendar's days are numbered.
G. Patrick Vennebush
Math Jokes 4 Mathy Falks
Robert D. Reed Publishers, 2010

# Calendar Magic

Every 4th year is leap unless it's divisible by 100. This is only true with one additional caveat: among those divisible by 100, the ones that are divisible by 400 are still leap. As every one can see, this adds to the argument that calendars are deeply involved with mathematics. Or, perhaps, it's the other way round. Below there is a Java monthly calendar that may be used to discover some simple mathematics built into calendar tables. Due to a bug in (my) Java libraries, the calendar only works for the years between 1970 and 2037 (inclusive). It's more than enough to make a few math discoveries.

This is how you use the applet. When the second button on the left reads "Set", drag the cursor inside the table and select a square array of dates. Once you are satisfied with your selection, click the button. The label will change to "Reset". Now pick up dates inside the select area by clicking on them. You should (and in fact only allowed to) select one date in each row and in each column. Sum up selected dates. The sum that also appears in the lower right corner does not depend on selection of dates inside the square but only on the square itself. You can check this fact by pressing the same button, which now reads "Reset". See if you can verify or even prove this.

### This applet requires Sun's Java VM 2 which your browser may perceive as a popup. Which it is not. If you want to see the applet work, visit Sun's website at https://www.java.com/en/download/index.jsp, download and install Java VM and enjoy the applet.

 What if applet does not run?

You may wrap the above into a stunning public performance. Show the public a calendar table and ask a volunteer to outline a square portion of the table. You glance at the table, write something on a piece of paper, which you fold and hand to the volunteer. Invite now participants to circle dates according to the above rules: one circle in each row and column of the selected area. When finished, let the volunteer add the circled numbers. Ask him or her to check what it was you wrote on the piece of paper. To every one's surprise it ought to be the sum of circled numbers.

A calendar table has other interesting properties. For example, for any three dates located successively in a row or a column or even diagonally, the middle one serves as an average of the other two.

Selecting dates so that there be only one per row and only one per column is equivalent to placing rooks on a chessboard so that they do not threaten each other. So the puzzle may be played on boards larger than 4x4 (maximum available with a calendar device) provided the fields are numbered in a proper way. How should the fields be numbered to preserve the properties we observed on the calendar boards?

For this one you may need a calculator. Select three consecutive dates in a row, column, or diagonal. Write them one beside another to form a single number. This is number One. Select another three dates and write them down to get number Two. Multiply number One by number Two (this is where you'll need a calculator). Give me the list of digits of the product skipping just one digit. I'll tell you which digit you have skipped.

Explanation

## Remark

Yakov Borovskiy, a schoolmate of mine, reminded me that, as far as the nice properties of the monthly calendars go, there is one exception, September 1752 whose table really looks weird:

```Su Mo Tu We Th Fr Sa
1  2 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
```

The strange appearance reflects the change from the Julian to the Gregorian calendar we use today. The new dating system was proclaimed in 1582 by Pope Gregory XIII. Those countries where the change has been accepted immediately (the Italian states, Portugal, Spain, 1582; the catholic German states, 1583), the day following October 4, was reckoned as October 15. (As a matter of fact, St. Theresa of Àvila died during the night between the 4th and 15th of October 1582.) Protestant German states adopted the new calendar in 1699; England and its colonies in 1752 (which explains the September 1752's anomaly); Sweden in 1753; Japan in 1783; China in 1912; Russia in 1918, Greece in 1923. (There is more about dates and calendars in the Encyclopædia Britannica.)

## References

1. W. Simon, Mathematical Magic, Dover, 1964

## Explanation

The abundance of patterns in a calendar table is due to simple properties of arithmetic progressions (or series). These are sequences of numbers with a fixed difference between any two consecutive members. In a row the difference is 1, in a column 7, on diagonals 6 and 8 (or -6 and -8 depending whether you count downwards or upwards.) Three consecutive terms in any arithmetic series can be written as a, a+d, a+2d. Then the average (a + (a+2d))/2 of the outer two equals (a+d) which is the middle term. From here it also follows that the sum of three successive numbers is (3a+3d) and is divisible by 3.

Since the number is divisible by 3 iff the sum of its digits is divisible by 3, should we write three dates located successively in a row, or a column, or diagonally, the resulting number will be always divisible by three. The product of two such numbers will therefore be divisible by 9. Thus, the sum of its digits will be also divisible by 9. So it's easy to detect a missing digit.

In a, say, 4x4 square the dates can be written as

 (a) (a)+1 (a)+2 (a)+3 (a+7) (a+7)+1 (a+7)+2 (a+7)+3 (a+14) (a+14)+1 (a+14)+2 (a+14)+3 (a+21) (a+21)+1 (a+21)+2 (a+21)+3

If we choose four dates following the rule that only one is selected per row and only one per column, when we add them up, there will be only one in the form (...)+1, only one in the form (...)+2, and so on. Inside parentheses we'll have only one (a) and only one (a+7) and so on. Therefore, the sum will always be equal to 4a + (0+7+14+21) + (0+1+2+3) = 4a + 48.

The problem of selection of elements 1 per row and 1 per column is the same as constructing a Latin square of a given size. The same idea works for a special case of the Toys and Tots problem (William A McWorter Jr.)

n toys are to be distributed among k children. For i=1,...,n, the i-th toy is worth i dollars. To please the parents, the total dollar value of the toys each child receives should be exactly the same. To please the children, each child should receive no more than one more toy than any other child receives. Determine when such a distribution is possible and describe a distribution when it is possible.

In the case where n is divisible by k2, there is a very elegant solution. Arrange the n toys in a k by n array where the dollar value of each toy increases from left to right and top to bottom. Here is a sample arrangement for k=3 and n=27.

```       1  2  3  4  5  6  7  8  9
10 11 12 13 14 15 16 17 18
19 20 21 22 23 24 25 26 27
```

Now, using the children's names as symbols, form any k by k latin square. For example, for k=3 and names Dawn, Dee, and Mary,

```     Dawn  Dee   Mary
Dee   Mary  Dawn
Mary  Dawn  Dee
```

Cover the array with three copies of this latin square and give each child those toys under his or her name. By calendar magic, the 9 toys each child receives have the same total dollar value. For the example above, the table below gives the toys each child receives, the total value each child receives being \$126.

### Note

A more general puzzle is described elsewhere.