From The Sunday Times, 15th March 1981 [link]
Young Mary, who is good at manipulating figures, was playing with her standard set of dominoes and seeing what numerical structures she could form with them, treating each half-domino as a digit according to its number of spots (“blank” being 0).
Starting with double-6/double-5/double-4 laid end-to-end in a row, she built forwards and downwards from that beginning, placing dominoes across and apparently at random, until she had completed a solid rectangle by slotting into the only remaining gaps, in its farther half, her last two dominoes which were 4-&-blank and 2-&-blank.
Whereupon she called out to me: “Uncle, do come and look! I’ve managed to arrange all my dominoes in a rectangle so that the numbers formed by the four halves in each column are all dissimilar 4-digit squares”.
“Are you quite sure about that?” I temporised.
“Certain,” she replied. “And they’re pretty well in correct order of magnitude too!”.
When I protested that this was quite impossible with dominoes, she said reproachfully: “But Uncle, I never said that ALL the squares appear in the right order, did I? Actually there are just two of them — both among the seven smallest present — which do not; but every single square except those two is definitely just where it would be if all those appearing were strictly in order of magnitude”.
She was perfectly correct. And you don’t need dominoes to figure out …
Which four of Mary’s together formed columns 7 and 8 of her rectangle? (Use figures, e.g. 4-0 = four-&-blank).
This was the final puzzle to use the title Brain-Teaser. The next puzzle was Brain teaser 974.
[teaser973]
Jim Randell 9:33 am on 15 June 2023 Permalink |
I supposed the numbers were from 1 to 99 (although you can also use 0 if you like).
This Python program combines the [[ int2words() ]] and [[ filter_unique() ]] functions from the enigma.py library.
It runs in 58ms. (Internal runtime is 267µs).
Run: [ @replit ]
from enigma import (irange, int2words, filter_unique, intersect, join, printf) # numbers from 1 to 99 as words ns = dict((n, int2words(n)) for n in irange(1, 99)) # return a function to select letters at indices <js> from the spelling of a number select = lambda *js: (lambda k: join(ns[k][j] for j in js)) # the number is ambiguous by first letter ss1 = filter_unique(ns.keys(), f=select(0)).non_unique # but unique by first + last letter ss2 = filter_unique(ns.keys(), f=select(0, -1)).unique # from these it is unique by last letter ss = filter_unique(intersect([ss1, ss2]), f=select(-1)).unique # output solution printf("{ss}", ss=join(ss, sep=", "))Solution: The number is 98.
LikeLike
Frits 2:06 pm on 15 June 2023 Permalink |
Maintaining a dictionary.
from enigma import int2words # lowercase letters letters = ''.join(chr(ord('a') + i) for i in range(26)) # numbers from 1 to 99 as words nums = [int2words(n) for n in range(1, 100)] # the number is ambiguous by first letter d = {l: [x for x in nums if x[0] == l] for l in letters} d = {k: vs for k, vs in d.items() if len(vs) > 1} # but unique by first + last letter d = {l1 + l2: [x for x in nums if x[0] == l1 and x[-1] == l2 and x[0] in d] for l1 in letters for l2 in letters} d = {k: vs for k, vs in d.items() if len(vs) == 1} # from these it is unique by last letter d = {k[-1]: [vs2 for k2, vs2 in d.items() if k[-1] == k2[-1]] for k in d} d = {k: vs for k, vs in d.items() if len(vs) == 1} for k, v in d.items(): print("answer:", *v[0])LikeLike