The cryptarithm FLOOBLE + PUZZLE = PERPLEX has no solutions. But if the word 'PUZZLE' is included twice, then there is a solution.
How many more times can the word 'PUZZLE' appear in the addition and the cryptarithm still have a solution?
First, we assume neither F nor P can be zero.
Then, if there were 10 occurrences of PUZZLE, you'd get a 7-digit number that would have at least F added to the leading P (and possibly a carry), making the sum a number that's larger than a 7-digit one beginning with P. So any more than 9 occurrences of PUZZLE are ruled out. The program checks one through nine occurrences of PUZZLE:
DEFDBL A-Z
FOR n = 1 TO 9
PRINT n
FOR f = 1 TO 9
PRINT f;
taken(f) = 1
FOR l = 0 TO 9
IF taken(l) = 0 THEN
taken(l) = 1
FOR o = 0 TO 9
IF taken(o) = 0 THEN
taken(o) = 1
FOR b = 0 TO 9
IF taken(b) = 0 THEN
taken(b) = 1
FOR e = 0 TO 9
IF taken(e) = 0 THEN
taken(e) = 1
flooble = f * 1000000 + l * 100010 + o * 11000 + b * 100 + e
FOR p = 1 TO 9
IF taken(p) = 0 THEN
taken(p) = 1
p0 = p * 1001000 + e * 100010 + l * 100
FOR u = 0 TO 9
IF taken(u) = 0 THEN
taken(u) = 1
FOR z = 0 TO 9
IF taken(z) = 0 THEN
taken(z) = 1
puzzle = n * (p * 100000 + u * 10000 + z * 1100 + l * 10 + e)
FOR r = 0 TO 9
IF taken(r) = 0 THEN
taken(r) = 1
p1 = p0 + r * 10000
FOR x = 0 TO 9
IF taken(x) = 0 THEN
taken(x) = 1
perplex = p1 + x
IF flooble + puzzle = perplex THEN
PRINT
PRINT flooble: PRINT puzzle / n; "*"; n
PRINT perplex: PRINT
END IF
taken(x) = 0
END IF
NEXT x
taken(r) = 0
END IF
NEXT r
taken(z) = 0
END IF
NEXT z
taken(u) = 0
END IF
NEXT u
taken(p) = 0
END IF
NEXT p
taken(e) = 0
END IF
NEXT e
taken(b) = 0
END IF
NEXT b
taken(o) = 0
END IF
NEXT o
taken(l) = 0
END IF
NEXT l
taken(f) = 0
NEXT
PRINT
NEXT
The solutions have 2, 3, 4 or 7 occurrences of PUZZLE, the number of times marked after the * in the following:
6255028
791128 * 2
7837284
4399732
605532 * 3
6216328
4177319
682219 * 4
6906195
1499246
307746 * 7
3653468
|
Posted by Charlie
on 2007-03-31 16:25:48 |