Sunday Times Teaser 2553 – The X-Factor
by Danny Roth
Published: 28 August 2011 (link)
George and Martha’s daughter entered a singing competition. The entrants were numbered from one upwards. The total number of entrants was a three- figure number and their daughter’s number was a two-figure number. The five digits used in those two numbers were all different and non-zero. Martha noted that the number of entrants was a single-digit multiple of their daughter’s number. George realised the same would be true if the two digits of their daughter’s number were reversed.
How many entrants were there?
2 Comments
Leave one →
-
geoffrounce permalink123456789101112131415161718192021for e in range(100, 999): # e = number of entrantsfor d in range(10, 99): # d = daughter's numbere_str, d_str = str(e), str(d)# check if zero is in two or three digit numbers# and check all five digits used are differentif '0' in e_str or '0' in d_str: continuer_str = e_str + d_strif len(set(r_str)) != 5: continue# check entrants number is a multiple of the daughter's numberq, r = divmod(e, d)if q < 10 and r == 0:dig1, dig2 = d // 10, d % 10d2 = 10 * dig2 + dig1 # daughter's reverse number# check entrants number is a multiple of the daughter's reverse numberq2, r2 = divmod(e, d2)if q2 < 10 and r2 == 0:print('Number of entrants =', e)