DECLARE SUB permute (a$)
CLS
DEFDBL A-Z
a$ = "1234567890": h$ = a$
PRINT " hell", " eden", " overlap"
DO
IF INSTR(a$, "0") > 3 THEN
h = VAL(MID$(a$, 1, 1))
e = VAL(MID$(a$, 2, 1))
o = VAL(MID$(a$, 3, 1))
l = VAL(MID$(a$, 4, 1))
d = VAL(MID$(a$, 5, 1))
n = VAL(MID$(a$, 6, 1))
v = VAL(MID$(a$, 7, 1))
r = VAL(MID$(a$, 8, 1))
a = VAL(MID$(a$, 9, 1))
p = VAL(MID$(a$, 10, 1))
END IF
hell = 1000 * h + 100 * e + 11 * l
eden = 1010 * e + 100 * d + n
overlap = 1000000 * o + 100000 * v + 10000 * e + 1000 * r + 100 * l + 10 * a + p
IF hell * eden = overlap THEN PRINT hell, eden, overlap
permute a$
LOOP UNTIL a$ = h$
finds
hell eden overlap
2433 4047 9846351
resulting in
head over heels in love
2450 9846 2443S I7 3984
|
Posted by Charlie
on 2014-03-24 14:03:07 |