All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > General
Multiply Month and Day (Posted on 2011-11-12) Difficulty: 3 of 5
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).

See The Solution Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 2

I'm assuming that mm-dd-yy requires that all three pieces require leading zeros when otherwise there would be only a single digit.

DATA 31,28,31,30,31,30,31,31,30,31,30,31
DIM molen(12)
FOR i = 1 TO 12: READ molen(i): NEXT
CLS

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
   END IF
 NEXT
NEXT
 IF yrtotct > maxyrtotct THEN maxyr = yy: maxyrtotct = yrtotct
 IF yrtotct = 329 THEN PRINT yy
NEXT
PRINT totct
PRINT maxyrtotct, maxyr
PRINT mmsave; ddsave; yysave

finds


 4
 8
 20
 40
 60
 80
 6020
 329           4
 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
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information