(In reply to
No real spoiler by brianjn)
What I had said in the queue was that one way of making the solution unique would have been to limit the digits to the range 0 through 8, rather than specifying non-zero digits.
The program below sought solutions leaving out any one of the ten digits.
DECLARE SUB permute (a$)
CLS
' gethisajo
a$ = "1234567890": h$ = a$
DO
IF MID$(a$, 1, 1) > "0" AND MID$(a$, 4, 1) > "0" AND MID$(a$, 7, 1) > "0" AND MID$(a$, 8, 1) > "0" THEN
getv = VAL(LEFT$(a$, 3))
hisv = VAL(MID$(a$, 4, 3))
agev = VAL(MID$(a$, 7, 1) + MID$(a$, 1, 2))
joev = VAL(MID$(a$, 8, 2) + MID$(a$, 2, 1))
IF getv + hisv = agev AND ABS(getv - hisv) = joev THEN
PRINT "g+h=a", getv; hisv; agev; joev, RIGHT$(a$, 1)
END IF
IF getv + hisv = joev AND ABS(getv - hisv) = agev THEN
PRINT "g+h=j", getv; hisv; joev; agev, RIGHT$(a$, 1)
END IF
IF getv + agev = hisv AND ABS(getv - agev) = joev THEN
PRINT "g+a=h", getv; agev; hisv; joev, RIGHT$(a$, 1)
END IF
IF getv + agev = joev AND ABS(getv - agev) = hisv THEN
PRINT "g+a=j", getv; agev; joev; hisv, RIGHT$(a$, 1)
END IF
IF getv + joev = hisv AND ABS(getv - joev) = agev THEN
PRINT "g+j=h", getv; joev; hisv; agev, RIGHT$(a$, 1)
END IF
IF getv + joev = agev AND ABS(getv - joev) = hisv THEN
PRINT "g+j=a", getv; joev; agev; hisv, RIGHT$(a$, 1)
END IF
IF hisv + agev = getv AND ABS(hisv - agev) = joev THEN
PRINT "h+a=g", hisv; agev; getv; joev, RIGHT$(a$, 1)
END IF
IF hisv + agev = joev AND ABS(hisv - agev) = getv THEN
PRINT "h+a=j", hisv; agev; joev; getv, RIGHT$(a$, 1)
END IF
IF hisv + joev = getv AND ABS(hisv - joev) = agev THEN
PRINT "h+j=g", hisv; joev; getv; agev, RIGHT$(a$, 1)
END IF
IF hisv + joev = agev AND ABS(hisv - joev) = getv THEN
PRINT "h+j=a", hisv; joev; agev; getv, RIGHT$(a$, 1)
END IF
IF agev + joev = getv AND ABS(agev - joev) = hisv THEN
PRINT "a+j=g", agev; joev; getv; hisv, RIGHT$(a$, 1)
END IF
IF agev + joev = hisv AND ABS(agev - joev) = getv THEN
PRINT "a+j=h", agev; joev; hisv; getv, RIGHT$(a$, 1)
END IF
END IF
permute a$
LOOP UNTIL a$ = h$
The results are tabulated below. The first row for zero being unused is:
g+j=h 524 372 896 152 0
which is translated as
524 + 372 = 896
get + joe = his
get - joe = age
524 - 372 = 152
The other three are deciphered in the same way:
h+j=g 456 283 739 173 0
h+a=g 568 174 742 394 0
h+j=g 568 374 942 194 0
g stands for get
h stands for his
a stands for age
j stands for joe
If the unused digit had been 9 the answer would have been unique:
a+j=h 652 132 784 520 9
652 132 784
age + joe = his
age - joe = get
652 132 520
the same order remaining digit
addition as at left word value not used
h+a=j 380 216 596 164 7
h+a=j 540 321 861 219 7
h+a=j 570 324 894 246 1
a+j=h 627 357 984 270 1
a+j=h 429 139 568 290 7
h+a=j 460 132 592 328 7
a+j=h 534 194 728 340 6
a+j=h 652 132 784 520 9
g+j=h 524 372 896 152 0
h+a=j 690 153 843 537 2
a+j=h 754 214 968 540 3
g+a=h 548 154 702 394 6
g+a=j 610 261 871 349 5
h+j=a 820 147 967 673 5
h+j=g 456 283 739 173 0
h+a=g 568 174 742 394 0
g+a=j 760 176 936 584 2
a+j=g 576 186 762 390 4
a+j=g 579 219 798 360 4
g+j=a 860 126 986 734 5
h+j=g 568 374 942 194 0
|
Posted by Charlie
on 2013-03-26 22:49:13 |