Sunday Times Teaser 2712 – New Tricks
by Andrew Skidmore
In the sum:
CRAWL = SIT + WALK + TALK
different letters consistently represent different digits, all four numbers are odd and there are no leading zeros.
What numeric value does TRICK represent?
One Comment
Leave one →
-
brian gladman permalink1234567891011121314151617181920212223242526272829from itertools import permutationsprint('TRICK (SIT CRAWL WALK TALK)')# Since CRAWL is the sum of a three digit and two four digit# numbers, C can only be 1C = 1# choose odd digits for T, L and Kfor T, L, K in permutations((3, 5, 7, 9), 3):# permute remaining digits for remaining lettersrem = set(range(10)) - set((C, T, L, K))for A, I, R, S, W in permutations(rem, 5):# leading digits cannot be zeroif S and W:# compute SIT, ALK (for WALK and TALK) and CRAWLsit = 100 * S + 10 * I + Talk = 100 * A + 10 * L + Kcrawl = 10000 * C + 1000 * R + 100 * A + 10 * W + L# test that CRAWL equals the sum of SIT, WALK and TALKif crawl == sit + 1000 * (W + T) + 2 * alk:trick = 10000 * T + 1000 * R + 100 * I + 10 * C + Kprint('{} {}'.format(trick,(sit, crawl, 1000 * W + alk, 1000 * T + alk)))