From The Sunday Times, 9th December 1979 [link]
During my recent trip into the jungle, I came across a clearing, at the centre of which was a stone with the following design:

On closer inspection, I saw that the small squares were numbered from 1 to 10 (left to right along the bottom row), then from 11 to 20 (right to left on the next row up), 21 to 30 (left to right on the third row up), and so on. The lines joined the following pairs of squares:
13 & 32
25 & 48
35 & 54
45 & 66
63 & 88
79 & 94
My guide explained that it was a very old snakes and ladders board. However, due to the ravages of time, it was not possible to tell which of the six lines were snakes and which were ladders. Fortunately the guide knew a legend concerning the board, and he told it to me.
Many years ago, the king of that region had a beautiful daughter, and offered her in marriage to the first man who could get from square 1 to square 100 in just one turn. After many young men had tried and failed, a handsome prince from a neighbouring country had his turn, and threw 12 consecutive sixes. As he stood on square 1 to start, the first six took him to square 7. The remaining sixes took him to square 100.
Which of the lines are snakes?
This puzzle is included in the book The Sunday Times Book of Brain-Teasers: Book 2 (1981). The puzzle text above is taken from the book.
It is also included in the book The Sunday Times Book of Brainteasers (1994).
[teaser914]
Jim Randell 8:47 am on 29 March 2022 Permalink |
This Python program constructs candidate values for the rows and the columns, and then fills out the rows, ensuring there are always available candidates for the columns.
Once the grid is filled out the columns are checked to ensure they meet the puzzle requirements.
It runs in 61ms.
Run: [ @replit ]
from enigma import (irange, inf, cb, Primes, int2roman, union, unpack, update, delete, join, match, roman2int, printf) # max number N = 399 # 5-digit roman numerals, map: int -> roman rom5 = dict() for n in irange(1, N): r = int2roman(n) if len(r) != 5: continue assert not ('M' in r or 'D' in r) rom5[n] = r # generate roman numerals from function f def romans(f, a=1): for i in irange(a, inf): n = f(i) if n > N: break r = rom5.get(n) if r: yield r # categorise the roman numerals into sets evens = set(v for (k, v) in rom5.items() if k % 2 == 0) cubes = set(romans(cb)) ps = Primes(N + 1) primes = set(v for (k, v) in rom5.items() if k in ps) pow2s = set(romans(lambda n: 2**n)) # row/column candidates rcs = [evens, evens, cubes, primes, pow2s] ccs = [union([cubes, evens, primes])] * 5 # return column candidates for rows rs def col_cand(rs, ccs): ccs_ = list() # consider each column for (j, t) in enumerate(zip(*rs)): # make the template t = join(t) cs = list(x for x in ccs[j] if match(x, t)) if not cs: return ccs_.append(cs) return ccs_ # fill out the grid (rows), respecting row/col candidates # rs = partially completed grid (rows) # rcs = row candidates; map <index> -> <candidates> # ccs = col candidates def solve(rs, rcs, ccs): # are we done? if not rcs: yield rs else: # choose a row (k, vs) = min(rcs.items(), key=unpack(lambda k, vs: len(vs))) # choose a value for v in vs: rs_ = update(rs, [k], [v]) # check columns in the new grid match cs_ = col_cand(rs_, ccs) if cs_: # solve for the remaining rows yield from solve(rs_, delete(rcs, [k]), cs_) # initial grid g = ['?????'] * 5 for rs in solve(g, dict(enumerate(rcs)), ccs): cs = list(map(join, zip(*rs))) # rows and columns are all different if len(union([rs, cs])) != 10: continue # check the columns: exactly 1 is a cube, the others are even or prime cbs = set() eps = set() for (i, x) in enumerate(cs): if x in cubes: cbs.add(i) if x in primes or x in evens: eps.add(i) if not (len(cbs) == 1 and len(eps) == 4 and (not cbs.issubset(eps))): continue # output solution for (t, vs) in zip(['rows', 'cols'], (rs, cs)): fmt = lambda vs: join(vs, sep=" | ", enc=("[ ", " ]")) printf("{t}: {vs} = {ns}", vs=fmt(vs), ns=tuple(roman2int(v) for v in vs)) printf()Solution: The middle row is CCXVI (216). The middle column is LXXIX (79).
The completed grid looks like this:
LikeLike
Jim Olson 6:30 pm on 29 March 2022 Permalink |
Typo on the last column. Should be “23” which is still a prime number.
LikeLike
Jim Randell 9:19 pm on 29 March 2022 Permalink |
Thanks. I’ve corrected the image now.
LikeLike