Marissa and Melissa both want to know the other's birthday. Each of them knows her own birthday. They have the following conversation.
Marissa:What day of the month were you born on?
Melissa says what day of the month she was born on.
Marissa:I now know that our birthdays are never on the same day of the week in the same year.
Marissa says what day of the month she was born on.
Melissa:That is a prime number. However, I cannot figure out what your birth month is.
Marissa:My birth month has the same number of days as your birth month.
Melissa:The sum of the digits in the day of the month you were born on equals the position of my birth month in the year.
What is Marissa's birthday? What is Melissa's birthday?
Days of the month under 31 would always have some particular day of the week represented, so Melissa's birthday must be on the 31st.
Possible dates for Marissa's birth day (a prime date of the month), where the 31st of any month in any year, regular or leap, could not be on the same day of the week as the given date, are:
day month
2 9 or 12
3 6
5 8
7 10
11 3 or 11
13 5
17 6
19 8
23 9 or 12
29 4 or 7
Since Melissa can't determine the month from the date within month, the date given must be 2, 11, 23 or 29.
Marissa must have been born in a 31day month: 3, 7 or 12. That's enough to tell Melissa which month it is once Marissa has given her this 31day month info.
The sum of digits of 2 (for the date in December) doesn't make too much sense, and February doesn't have 31 days anyway.
The sum of the digits of 11 is 2; of 23 is 5; of 29 is 11. Only the 5th month has 31 days.
Melissa was born May 31. Marissa was born December 23.
Table created with the help of:
DEF fndw (x) = x  INT(x / 7) * 7
DATA 2,3,5,7,11,13,17,19,23,29,31
DIM pr(11)
FOR i = 1 TO 11: READ pr(i): NEXT
FOR m = 1 TO 12
FOR prno = 1 TO 11 'marissa has prime bday in month
FOR melD = 31 TO 31
FOR y = 2015 TO 2016
ye = y: mo = m: da = pr(prno)
GOSUB greg.to.jd
marDoW = fndw(jd)
good = 1
FOR m2 = 1 TO 12
IF m2 <> 2 AND m2 <> 4 AND m2 <> 6 AND m2 <> 9 AND m2 <> 11 THEN
ye = y: mo = m2: da = melD
GOSUB greg.to.jd
IF fndw(jd) = marDoW THEN good = 0: EXIT FOR
END IF
NEXT
IF good = 0 THEN EXIT FOR
NEXT y
IF good THEN PRINT m; pr(prno), melD
NEXT melD
NEXT prno
NEXT m
END
greg.to.jd:
10100 REM :greg mo/da/ye > jd at noon
10110 GOSUB jul.to.jd
10120 jd = jd + 2  INT(cw(1) / 100) + INT(cw(1) / 400)
10130 RETURN
jul.to.jd:
10150 REM :jul mo/da/ye > jd at noon
10160 cw(0) = mo: cw(1) = ye: IF mo < 3 THEN cw(0) = mo + 12: cw(1) = ye  1
10170 jd = INT(365.25 * cw(1)) + INT(30.61 * (cw(0) + 1)) + da + 1720995!
10180 RETURN
though it falsely created a June 31, as checking month length was not done, but that was ignored when copying the dates for the table.

Posted by Charlie
on 20150917 12:20:00 