DEFDBL A-Z
FOR d = 1 TO 10
used(d) = 1
FOR s = 0 TO 10
IF used(s) = 0 THEN
used(s) = 1
FOR y = 0 TO 10
IF used(y) = 0 AND (s - y + 11) MOD 11 = d THEN
used(y) = 1
FOR a = 0 TO 10
IF used(a) = 0 THEN
used(a) = 1
FOR e = 0 TO 10
IF used(e) = 0 THEN
used(e) = 1
FOR l = 0 TO 10
IF used(l) = 0 THEN
rdr = ((a - e) * 11 + s - y + 121) MOD 121
IF rdr = 11 * l + d THEN
used(l) = 1
FOR m = 0 TO 10
IF used(m) = 0 THEN
used(m) = 1
FOR o = 0 TO 10
IF used(o) = 0 THEN
used(o) = 1
FOR g = 1 TO 10
IF used(g) = 0 THEN
used(g) = 1
FOR h = 0 TO 10
IF used(h) = 0 THEN
used(h) = 1
FOR t = 1 TO 10
IF used(t) = 0 THEN
used(t) = 1
thomas = t
thomas = thomas * 11 + h
thomas = thomas * 11 + o
thomas = thomas * 11 + m
thomas = thomas * 11 + a
thomas = thomas * 11 + s
daley = d
daley = daley * 11 + a
daley = daley * 11 + l
daley = daley * 11 + e
daley = daley * 11 + y
gold = g
gold = gold * 11 + o
gold = gold * 11 + l
gold = gold * 11 + d
IF thomas - daley = gold THEN
PRINT t; h; o; m; a; s
PRINT d; a; l; e; y
PRINT g; o; l; d
PRINT
END IF
used(t) = 0
END IF
NEXT t
used(h) = 0
END IF
NEXT h
used(g) = 0
END IF
NEXT g
used(o) = 0
END IF
NEXT o
used(m) = 0
END IF
NEXT m
used(l) = 0
END IF
END IF
NEXT l
used(e) = 0
END IF
NEXT e
used(a) = 0
END IF
NEXT a
used(y) = 0
END IF
NEXT y
used(s) = 0
END IF
NEXT s
used(d) = 0
NEXT d
From Enigma No. 1581, "Daley's Gold", by Richard England, New Scientist, 6 February 2010, page 26.
Comments: (
You must be logged in to post comments.)