DEFDBL A-Z
CLS
FOR d4 = 0 TO 8 STEP 2
used(d4) = 1
FOR d6 = 0 TO 5 STEP 5
IF used(d6) = 0 THEN
used(d6) = 1
FOR d1 = 1 TO 9
IF used(d1) = 0 THEN
used(d1) = 1
FOR d2 = 0 TO 9
IF used(d2) = 0 THEN
used(d2) = 1
FOR d3 = 0 TO 9
IF used(d3) = 0 THEN
used(d3) = 1
FOR d5 = 0 TO 9
div3 = 100 * d3 + 10 * d4 + d5
IF used(d5) = 0 AND div3 MOD 3 = 0 THEN
used(d5) = 1
FOR d7 = 0 TO 9
div7 = 100 * d5 + 10 * d6 + d7
IF used(d7) = 0 AND div7 MOD 7 = 0 THEN
used(d7) = 1
FOR d8 = 0 TO 9
div11 = 100 * d6 + 10 * d7 + d8
IF used(d8) = 0 AND div11 MOD 11 = 0 THEN
used(d8) = 1
FOR d9 = 0 TO 9
div13 = 100 * d7 + 10 * d8 + d9
IF used(d9) = 0 AND div13 MOD 13 = 0 THEN
used(d9) = 1
FOR d10 = 0 TO 9
div17 = 100 * d8 + 10 * d9 + d10
IF used(d10) = 0 AND div17 MOD 17 = 0 THEN
used(d10) = 1
PRINT d1; d2; d3; d4; d5; d6; d7; d8; d9; d10
used(d10) = 0
END IF
NEXT
used(d9) = 0
END IF
NEXT
used(d8) = 0
END IF
NEXT
used(d7) = 0
END IF
NEXT
used(d5) = 0
END IF
NEXT
used(d3) = 0
END IF
NEXT
used(d2) = 0
END IF
NEXT
used(d1) = 0
END IF
NEXT
used(d6) = 0
END IF
NEXT
used(d4) = 0
NEXT
The results, sorted are:
1406357289
1430952867
1460357289
4106357289
4130952867
4160357289
The sum is 16695334890.
|
Posted by Charlie
on 2013-09-16 11:51:44 |