There are three 3 digit numbers such that the digits 1,2,3...8,9 are used once each to write them. They are found to be in the ratio 1:3:5
Find all such possible triplets.
DEFDBL A-Z
DECLARE SUB permute (a$)
CLS
a$ = "123456789": h$ = a$
DO
a = VAL(LEFT$(a$, 3))
b = VAL(MID$(a$, 4, 3))
c = VAL(RIGHT$(a$, 3))
IF a * 3 = b AND b * 5 = c * 3 THEN PRINT a; b; c
permute a$
LOOP UNTIL a$ = h$
does find only one solution:
129 387 645
|
Posted by Charlie
on 2010-11-11 18:50:28 |