Within the queue I mentioned to Ady that the original proposal had vast solutions. I put Ady the further possibility of changing his problem to offer just one solution*.
Dej Mar and Charlie offer a similar table as what follows. My Computer listing is less efficient than Charlie's although I think I may have limited the scope of the FOR .. NEXT LOOPs in a later trial but did not save them.
tmpt num dvr quo
1 125673 489 257
2 136782 459 298
3 147896 532 278
4 156784 239 656
5 156792 834 188
6 156894 237 662
7 246789 153 1613 *
8 256794 381 674
9 257891 463 557
10 345681 279 1239
11 345897 621 557
12 567891 243 2337
13 567892 134 4238
tmpt = 1
OPEN "c:\qb64\work\once.txt" FOR OUTPUT AS #1
FOR a = 1 TO 9
IF used(a) = 0 THEN
used(a) = 1
FOR b = 1 TO 9
IF used(b) = 0 THEN
used(b) = 1
FOR c = 1 TO 9
IF used(c) = 0 THEN
used(c) = 1
FOR d = 1 TO 9
IF used(d) = 0 THEN
used(d) = 1
FOR e = 1 TO 9
IF used(e) = 0 THEN
used(e) = 1
FOR f = 1 TO 9
IF used(f) = 0 THEN
used(f) = 1
FOR g = 1 TO 9
IF used(g) = 0 THEN
used(g) = 1
FOR h = 1 TO 9
IF used(h) = 0 THEN
used(h) = 1
FOR i = 1 TO 9
IF used(i) = 0 THEN
used(i) = 1
num = a * 10 ^ 5 + b * 10 ^ 4 + c * 10 ^ 3 + d * 10 ^ 2 + e * 10 + f
dvr = g * 100 + h * 10 + i
quo = num / dvr
LOCATE 1, 1: PRINT a; b; c; d; e; f; g; h; i, num; dvr; quo
IF quo = INT(quo) THEN
LOCATE 3, 1: PRINT tmpt, num; dvr; quo
PRINT #1, tmpt; num; dvr; quo
tmpt = tmpt + 1
END IF
used(i) = 0
END IF
NEXT
used(h) = 0
END IF
NEXT
used(g) = 0
END IF
NEXT
used(f) = 0
END IF
NEXT
used(e) = 0
END IF
NEXT
used(d) = 0
END IF
NEXT
used(c) = 0
END IF
NEXT
used(b) = 0
END IF
NEXT
used(a) = 0
END IF
NEXT
CLOSE 1
|
Posted by brianjn
on 2012-06-09 21:27:38 |