Teaser 2636: Simple Easter Teaser
From The Sunday Times, 31st March 2013 [link] [link]
I have written down three numbers, at least one of which is odd. Furthermore, one of the three is the sum of the other two. Then I have consistently replaced digits by letters, using different letters for different digits, and the numbers have become:
SIMPLE
EASTER
TEASERWhat number is EASTER?
[Incidentally, Easter Sunday 2013 has a palindromic date, 31/3/13. Interestingly, this happens next in 2031].
This puzzle completes the archive of puzzles originally published in 2013.
[teaser2636]
Jim Randell 10:36 am on 28 March 2024 Permalink |
At least one of the numbers is odd, so at least one of E or R must be odd.
We can check that one of the numbers is the sum of the other two by adding all of them together, and then this total must be twice one of the original numbers:
So the LHS must be an even number, and if both E and R were odd, the LHS would be an odd number, so only one of them can be odd. And if E is odd then the LHS is also odd, hence E must be even and R must be odd.
We can solve the puzzle using this expression directly with the [[
SubstitutedExpression]] solver from the enigma.py library.The following run file executes in 383ms. (Internal runtime of the generated program is 201ms).
Run: [ @replit ]
#! python3 -m enigma -rr SubstitutedExpression "SIMPLE + EASTER + TEASER in { 2 * SIMPLE, 2 * EASTER, 2 * TEASER }" # E is even, R is odd "E % 2 = 0" "R % 2 = 1" --answer="EASTER"Solution: EASTER = 278521.
And the sum is:
There is a further solution to this alphametic sum where all the terms are even:
For a faster program we can consider the three possible sums (which can be solved using the [[
SubstitutedExpression.split_sum()]] solver.The following Python program runs in 58ms. (Internal runtime is 8.6ms).
Run: [ @replit ]
from enigma import (SubstitutedExpression, delete, sprintf, join, printf) # words involved in the alphametic words = ['SIMPLE', 'EASTER', 'TEASER'] # try each word as the result for (i, result) in enumerate(words): expr = sprintf("{terms} = {result}", terms=join(delete(words, [i]), sep=" + ")) # construct the alphametic puzzle p = SubstitutedExpression.split_sum( expr, extra=["(E % 2 != 0) or (R % 2 != 0)"], # at least one is odd ).solver() # solve the puzzle for s in p.solve(verbose=0): # output solution printf("{expr} / {s}", s=p.substitute(s, expr))LikeLike
GeoffR 1:47 pm on 28 March 2024 Permalink |
LikeLike
Frits 9:13 pm on 28 March 2024 Permalink |
from itertools import permutations # EASTER # TEASER only valid sum ot the three sums (otherwise E = 0) # ------ + # SIMPLE # A can't be zero as it would also lead to M = 0 for R, E, S, T in permutations(range(1, 10), 4): # basic checks (R must be odd) if not ((2 * R) % 10 == E and R % 2 and E + T in {S - 1, S}): continue if (L := (2 * E + (R > 5)) % 10) in {R, E, S, T}: continue if (P := (S + T + (E > 4)) % 10) in {R, E, S, T, L}: continue for A in set(range(1, 10)).difference({R, E, S, T, L, P}): EASTER = int(''.join(str(x) for x in [E, A, S, T, E, R])) TEASER = int(''.join(str(x) for x in [T, E, A, S, E, R])) if (SIMPLE := EASTER + TEASER) // 100000 != S: continue IM = (SIMPLE // 1000) % 100 if any(int(x) in {R, E, S, T, L, P, A} for x in str(IM)): continue print("answer:", EASTER)LikeLike