A "product digit-day" is a date in which the respective product of the digits of the month and the day multiply up to the product of the digits of the year in the mm-dd-yy format.
For example,12-18-28 is a product digit-day as the respective product of the digits of the month and the day multiply up to 16 which is equal to the product of the digits of the year.
(i) Determine the total number of product digit-days from January 1, 2001 to December 31, 2099 inclusively.
(ii) Determine the year(s) having the maximum number of product digit-days in the period covered under (i).
(iii) Determine the last product digit-day in the period covered under (i).
I'm assuming that mm-dd-yy requires that all three pieces require leading zeros when otherwise there would be only a single digit.
FOR i = 1 TO 12: READ molen(i): NEXT
FOR yy = 1 TO 99
yprod = (yy \ 10) * (yy MOD 10)
yrtotct = 0
FOR mm = 1 TO 12
mprod = (mm \ 10) * (mm MOD 10)
fin = molen(mm)
IF mm = 2 AND yy MOD 4 = 0 THEN fin = 29
FOR dd = 1 TO fin
dprod = (dd \ 10) * (dd MOD 10)
IF dprod * mprod = yprod THEN
totct = totct + 1
yrtotct = yrtotct + 1
mmsave = mm: ddsave = dd: yysave = yy
IF yrtotct > maxyrtotct THEN maxyr = yy: maxyrtotct = yrtotct
IF yrtotct = 329 THEN PRINT yy
PRINT maxyrtotct, maxyr
PRINT mmsave; ddsave; yysave
12 29 94
meaning there are 6020 such days in the period and years 04, 08, 20, 40, 60 and 80 contain the largest number of such days, 329, as the leading or trailing zeros combine with the extra day in February (month 02).
The last such day is 12-29-94.
Posted by Charlie
on 2011-11-12 18:40:03