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

 Tricky Ten Digit Number (Posted on 2006-07-31)
Find a number ABCDEFGHIJ, with all its digits different, such that:
• A, C, E, G, and I are odd
• HIJ is a multiple of BCD
• GH is a multiple of AB
• HIJ/BCD equals GH/AB

 No Solution Yet Submitted by Yosippavar Rating: 4.2500 (4 votes)

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

DECLARE SUB permute (a\$)
CLS
DEFDBL A-Z
odd\$ = "13579": even\$ = "02468"

oddH\$ = odd\$
DO

evenH\$ = even\$
DO
hij\$ = MID\$(even\$, 4, 1) + RIGHT\$(odd\$, 1) + RIGHT\$(even\$, 1)
bcd\$ = LEFT\$(even\$, 1) + MID\$(odd\$, 2, 1) + MID\$(even\$, 2, 1)
gh\$ = MID\$(odd\$, 4, 1) + MID\$(even\$, 4, 1)
ab\$ = LEFT\$(odd\$, 1) + LEFT\$(even\$, 1)
IF VAL(gh\$) / VAL(ab\$) = VAL(hij\$) / VAL(bcd\$) THEN
FOR i = 1 TO 5
PRINT MID\$(odd\$, i, 1) + MID\$(even\$, i, 1);
NEXT
PRINT VAL(gh\$) / VAL(ab\$)
END IF
permute even\$
LOOP UNTIL even\$ = evenH\$

permute odd\$
LOOP UNTIL odd\$ = oddH\$

finds all the cases where the given ratios are equal:

`3218709654 33476905812 1.7058823529411765812903476 .58620689655172419654703218 .3333333333333333`

but the ratio of only the first is an integer, so that is the answer.

 Posted by Charlie on 2006-07-31 14:11:55

 Search: Search body:
Forums (0)