PRINT
FOR o = 1 TO 9
IF used(o) = 0 THEN
used(o) = 1
FOR n = 0 TO 9
IF used(n) = 0 THEN
used(n) = 1
FOR e = 0 TO 9
IF used(e) = 0 THEN
used(e) = 1
one = o * 100 + n * 10 + e
FOR t = 1 TO 9
IF used(t) = 0 THEN
used(t) = 1
FOR w = 0 TO 9
IF used(w) = 0 THEN
used(w) = 1
two = t * 100 + w * 10 + o
IF one MOD two = 1 THEN
FOR s = 1 TO 9
IF used(s) = 0 THEN
used(s) = 1
FOR i = 0 TO 9
IF used(i) = 0 THEN
used(i) = 1
FOR x = 0 TO 9
IF used(x) = 0 THEN
used(x) = 1
six = s * 100 + i * 10 + x
IF six MOD two = 0 AND one MOD six = 1 THEN
PRINT one; two; six
END IF
used(x) = 0
END IF
NEXT
used(i) = 0
END IF
NEXT
used(s) = 0
END IF
NEXT
END IF
used(w) = 0
END IF
NEXT
used(t) = 0
END IF
NEXT
used(e) = 0
END IF
NEXT
used(n) = 0
END IF
NEXT
used(o) = 0
END IF
NEXT
produces
865 108 432
indicating one, two and six in that order.
|
Posted by Charlie
on 2008-11-30 21:44:26 |