Sunday Times Teaser 2688 – Mother’s Day
by H Bradley and C Higgins
(published on 30th March 2014)
My mother, her mother and I have each written down our birth dates in the form “ddmmyy’, where ‘dd’ is the two digit day, ‘mm’ is the two digit month and ‘yy’ is the last two digits of the year. It transpires that all of these numbers have six digits and no leading zeros.
My mother’s and my grandmother’s numbers are each multiples of my own and all of the digits from 0 to 9 occur somewhere within the three numbers.
What is my mother’s six-digit date of birth?
One Comment
Leave one →
-
brian gladman permalink12345678910111213141516171819202122232425# Valid six digit dates are in the range 100100 to 311199; so any# number that also has two different multiples in this range must# be less than 311200 / 3; so dd for me is 10 with multipliers of# 2 or 3; the maximum month is 12, so mm for me is 12 / 3 or lessfor me in range(100100, 100500):# assume that the mother and the grandmother were both born in# the 20th centurygmum, mum = sorted((2 * me, 3 * me), key=lambda x : x % 100)# check that these two dates are valid (only months cannot be)if not all(0 < x % 100 < 13 for x in (mum // 100, gmum // 100)):continue# check that the dates include all the digits from 0 to 9if len(set(str(me) + str(mum) + str(gmum))) != 10:continue# and that the mother and grandmother were born at least ten# years apartif mum % 100 - gmum % 100 < 10:continue# if my two digit year is less than my mother's, I must have been# born this century and hence can't be more than 14 years oldif me % 100 < mum % 100 and me % 100 > 14:continueprint('Mother: {} (Grandmother: {}, Me: {}).'.format(mum, gmum, me))