Puzzles

Prior to 2001 Puzzles

27 October 2000 (Product of the Date)

The problem statement from the Ole Miss Problems of the Week page is:

The date March 31, 1993 has an interesting trait, the product of the month and the day equals the last two digits of the year. In other words, on 3-31-93, the product of 3 and 31 is 93. Find the year that gives the greatest number of dates with this trait between the years 1900 and 2000.

Oh, goody! Another calendar question, like Date × Day = Year! Perhaps the same approach we used there will work for this one. Amazingly enough, we wrote a program for the CFX-9850G or FX-7400G programmable calculator before — why, by Jove, let us do the same here!

Again, we will loop through the days of a calendar year, and find the year for which the month×day product is the last two digits of the year. However, whether we should throw out dates like 25 April and 10 October (where the year should be 100) or use them is a question. Let us accumulate the count, and if the year 2000 (1900 + 100) does not come up as the maximum, we do not need to decide what to do about it — any decision would not affect the results. Unlike the previous puzzle, however, we do need to worry about how many days are in a month: the number of days in January, February, and March matters, as “phantom” days at the end of these months will have products that lie in the range 1-100. And we need to worry specially about February.

February has 28 days in common years, and 29 days in leap years. Whether 29 February needs to be counted depends on the year. Since 2×29 = 58, the question becomes, was 1958 a leap year? Leap years are years where the year number is divisible by 4, except year numbers divisible by 100 are not leap years, except year numbers divisible by 400 are leap years. 1958 is not divisible by 4, and so is not a leap year. So 29 February does not need to be counted. February can have 28 days for this problem.

Our overall approach will be to use one list (say List 1) as a count of the number of days in each month, and another list (say List 2) as a count of the number of times the property works for each year. The List 1 elements [1], ..., [12] will have the number of days in January, ..., December; the List 2 elements [1], ..., [100] will have the number of dates in 1901, ..., 2000 that have the property. (The number of days in 1900 where the product of the month number and the day number is the last two digits of the year is zero — for a product to be zero, one of the multiplier and multiplicand must be zero. Month and day numbers both start at 1, however, so their product is never zero.)

It is also possible that two or more years tie for first place. So, after we compute the number of dates in each year with the property, we go down the list and report all years for which the result is the same as the maximum of all the results.

The program, available here or as a text file with .CAT file contents, follows. As always, semicolons (“;”) start comments that are not to be entered into the calculator.

```; Variables:
;   A is the month number, then the year number
;   B is the number of days in the month denoted by A, then the
;     maximum number of dates where month*day=year in a particular
;     year
;   C is the day number within the month
;   D is the product of the month number and day number
;   List 1[x] is the number of days in month x
;   List 2[x] is the number of dates in year 1900+x where month*day =
;     x
; Symbols:
;   -> is assignment arrow
;   <= is less than or equal to relational
;   = is equal to relational

{31,28,31,30,31,30,31,31,30,31,30,31}->List 1
; The days per month list
Seq(0,A,1,100,1)->List 2
; Initialize the count of dates in each year to 0
For 1->A To 12     ; Loop for each month of the year
List 1[A]->B       ;   Find the number of days in the month
For 1->C To B      ;   Loop for each day in the month
AC->D              ;     Compute the product
If D<=100          ;     Test if the product is too large
Then List 2[D]+1->List 2[D]
;       If not, increment the appropriate year's
;         count
IfEnd              ;     [End of test on product too large]
Next               ;   [End of loop on days in the month]
Next               ; [End of loop on months in the year]
Max(List 2)->B     ; Find the maximum number of dates in a year
For 1->A To 100    ; Loop through each year
If List 2[A]=B     ;   Test whether this year has the maximum number
;     of dates
Then 1900+A_       ;     If so, print the year number
IfEnd              ;   [End of test on maximum number of dates]
Next               ; [End of loop through each year]
"Done"             ; Say we are done
```

We run the program, and it quickly reports:

```1924
Done
```

So 1924 is the year with the greatest number of dates where the product of the day number and the month number is the last two digits of the year number. And since 2000 is not a year with the greatest number of dates, we do not even have to worry about whether it should count.

As with our previous puzzle about day number times month number equaling year number, it is really not worth our while to try to figure out a “mathematical” solution. The problem would come down to enumerating the solutions to a set of Diophantine (integer) equations — which is exactly what the program did. In doing the problem by hand, we would notice that the early days of each month always select a year, but in April and following, the last days of the month do not — in December, for example, only the first eight days of the month correspond to years. But there is really not that much insight to be gained from working this problem symbolically.

It is interesting to take a look at List 2 after the program has run. The year 1924 has seven dates, the maximum. There is a six-way tie for second place with six dates: 1912, 1930, 1936, 1948, 1960, and 1972. The frequencies of the dates is as in the following table (not counting the year '00):

Days

Frequency

7

1

6

6

5

5

4

10

3

15

2

17

1

25

0

20

The median is 2, the mode is 1, the first quartile is 1, the third quartile is 3. The 20 for no days does not include year '00, so there are actually 21 years in each century has no date where there is no date for which the month number times a day number equals the last two digits of the year number. This means 79% of all years have a date where the month number times the day number equals the last two digits of the year number — so while this may be a remarkable occurrence, it is by no means rare.

Intriguing.

Page last updated 25 November 2001.

Brian’s Casio Calculator Corner

Home

Programs

Tutorial

Puzzles

Index

2001/2002

Previous years

Index

3 December 2000

27 October 2000

16 April 2000

9 April 2000

19 March 2000

13 February 2000

6 February 2000

28 November 1999

12 September 1999

8 August 1999

25 July 1999

11 July 1999

30 May 1999

4 April 1999

29 April 1996

In memoriam: Dijkstra

Site Information