# Puzzles

## 2001/2002 Puzzles

### 4 February 2001 (Date × Day = Year)

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

April 22, 1988 is represented by 4/22/88. Notice that the product of the month and day is equal to the two-digit representation of the year. Exactly how many times between January 1, 1990 and January 1, 2000 does the unique trait occur?

Sounds like a job for a programmable calculator to me. Doesn’t it sound like it to you? Fortunately, we just happen to have a Casio CFX-9850G or FX-7400G right here. Well, let’s get to it, then.

The obvious thing to do is to loop through all dates in the ten years, and check to see whether the date satisfies the condition. But since we keep getting burned by the “obvious” approach, perhaps a little more thought is in order.

If, say, 30 March is the day part of a date that satisfies the condition, then it is because the year part is 90 (3×30=90). That will be true for 30 March 1990, but not 30 March 1991, 30 March 1992, or 30 March of any other year. So we really do not need to test all the years — instead, we need to test whether the month number times the day number is a year in the appropriate range. So we really only need to go through one year’s worth of dates instead of 10 years’ worth of dates.

Cutting the search space down from 10 years’ worth of dates to one year’s worth of dates makes the search space small enough to to be conveniently enumerated — we can quit limiting the search space now and just test. But given the wonders of the Gregorian calendar, we are now faced with the problem of generating valid dates — 31 April does not exist, for example, so we would not want to find 31 April as a date. But, 31 February (if it were to exist) would give the year 1962, which does not meet the 1990-1999 range; and 31 April (if it were to exist) would give the year 2021, which also is not in the 1990-1999 range. Whether we test the 31st matters for March, and March only; but March actually does have 31 days, so that is fine. So it really does not matter whether we test through a theoretical 31st of every month rather than the actual last day of every month, as the “dates” that are not real dates will not satisfy the test anyway.

Using this simplification that we can just generate “dates” for all months assuming 31 days per month, the program absolutely jumps from our fingertips or mouth stick. It is available here as text, or as a text file with .CAT file contents. As always, semicolon starts a comment that is not to be entered into the calculator.

```; Variables:
;   A is month number (1 to 12)
;   B is day number (1 to 31)
;   C is month times year
;   D is count of times C is between 90 and 99, inclusive
; Symbols:
;   -> is assignment arrow
;   >= is greater than or equal to relational
;   <= is less than or equal to relational
;   _ is display triangle

0->D               ; Zero counter for dates found
For 1->A To 12     ; Loop through all month numbers, 1 to 12
For 1->B To 31     ;   Loop through all day numbers, 1 to 31
AB->C              ;     Find product of month and day numbers
If C>=90 And C<=99 ;     Test whether this is a year in range
Then 100(100A+B)+C_;       If so, report the date (mmddyy)
D+1->D             ;       And increment the count of dates found
IfEnd              ;     [End of test whether year is in range]
Next               ;   [End of loop through day numbers]
Next               ; [End of loop through month numbers]
"Count"            ; Label the count
D                  ; Display the count
```

Running the program, we get a list of the dates with the “unique trait,” here put into columns to save space, and punctuated with slashes between month, day, and year:

```3/30/90    5/18/90    7/13/91    9/11/99
3/31/93    5/19/95    7/14/98   10/09/90
4/23/92    6/15/90    8/13/96   11/09/99
4/24/96    6/16/96    9/10/90   12/08/96
```

Finally the calculator reports the count:

```Count
16
```

Despite the promise on the Puzzles index page, I am not going to give an analytical solution to this puzzle. The analytical solution would basically come down to a set of Diophantine (integers only) inequalities, then enumerating and counting the solutions — which we just had the computer do. Computers are much better at being computers than are people. This time, an analytical solution simply isn’t worth it.

Woah. I bet you never thought you would find a statement like that in these puzzle pages.

Page last updated 25 November 2001.

# Brian’s Casio Calculator Corner

Home

Programs

Tutorial

Puzzles

Index

2001/2002

Index

15 April 2002

11 February 2002

1 October 2001

24 September 2001

13 August 2001

30 July 2001

18 June 2001

4 June 2001

21 May 2001

7 May 2001

30 April 2001

23 April 2001

9 April 2001

18 February 2001

4 February 2001

29 January 2001

Previous years

In memoriam: Dijkstra

Site Information