Sunday Times Teaser 2537 – Odds and Evens
by Victor Bryant
Published: 8 May 2011 (link)
E | E | E | ||
O | O | O | ||
— | — | — | ||
E | E | E | E | E |
E | O | E | E | |
O | O | O | E | |
— | — | — | — | — |
O | E | O | O | E |
I have taken two three-figure numbers and multiplied them together by long multiplication. On the right are my workings, but with O marking the positions of the odd digits and E the even digits:
What are the two three-figure numbers?
One Comment
Leave one →
-
Brian Gladman permalink123456789101112131415161718192021222324252627from itertools import product# set three even values for the top row of the multiplicationfor a, b, c in product(range(0, 10, 2), repeat=3):top = 100 * a + 10 * b + c# set the hundreds digit for the bottom row of the multiplicationfor d in range(1, 10, 2):# compute and check the first partial sumt = tuple(map(lambda x : int(x) % 2, str(d * top)))if len(t) == 3 and t == (0, 0, 0):# set the tens digit for the bottom row of the multiplicationfor e in range(1, 10, 2):# compute and check the second partial sumt = tuple(map(lambda x : int(x) % 2, str(e * top)))if len(t) == 3 and t == (0, 1, 0):# set the units digit for the bottom row of the multiplicationfor f in range(1, 10, 2):# compute and check the third partial sumt = tuple(map(lambda x : int(x) % 2, str(f * top)))if len(t) == 4 and t == (1, 1, 1, 0):print(top, 'and', 100 * d + 10 * e + f)