All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Use all nine (Posted on 2012-06-08)
What 6-digit number ABCDEF is divisible evenly by GHI ?

Rem 1: The letters represent 9 distinct non-zero digits.
Rem 2: The digits A,B,C,D,E are in increasing order.
Rem 3: There are several solutions.

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution | Comment 2 of 3 |

FOR a = 1 TO 5
used(a) = 1
FOR b = a + 1 TO 6
used(b) = 1
FOR c = b + 1 TO 7
used(c) = 1
FOR d = c + 1 TO 8
used(d) = 1
FOR e = d + 1 TO 9
used(e) = 1

FOR f = 1 TO 9
IF used(f) = 0 THEN
used(f) = 1
abcdef = 100000 * a + 10000 * b + 1000 * c + 100 * d + 10 * e + f

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

ghi = 100 * g + 10 * h + i
IF abcdef MOD ghi = 0 THEN
PRINT abcdef, ghi, abcdef / ghi
END IF

used(i) = 0
END IF
NEXT i
used(h) = 0
END IF
NEXT h
used(g) = 0
END IF
NEXT g

used(f) = 0
END IF
NEXT

used(e) = 0
NEXT
used(d) = 0
NEXT
used(c) = 0
NEXT
used(b) = 0
NEXT
used(a) = 0
NEXT

produces

`ABCDEF        GHI        quotient`
`125673        489           257136782        459           298147896        532           278156784        239           656156792        834           188156894        237           662246789        153           1613256794        381           674257891        463           557345681        279           1239345897        621           557567891        243           2337567892        134           4238`

Of these, it can be noted that only 246789 has all the digits ABCDEF in order, rather than just the ABCDE required by the puzzle.

 Posted by Charlie on 2012-06-09 10:51:25

 Search: Search body:
Forums (0)