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

1. Different integers A, B, C, D consist of the same digits. A+B=C. B+C=D. What are the smallest numbers which satisfy this?

2. Can it also be solved if we add C+D=E?

 No Solution Yet Submitted by Danish Ahmed Khan Rating: 3.0000 (1 votes)

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

DEFDBL A-Z
CLS
FOR c = 2 TO 999
FOR a = 1 TO c / 2
b = c - a
d = b + c
as\$ = LTRIM\$(STR\$(a))
ds\$ = LTRIM\$(STR\$(d))
good = 1
FOR i = 1 TO LEN(ds\$)
ix = INSTR(as\$, MID\$(ds\$, i, 1))
IF ix = 0 THEN good = 0: EXIT FOR
as\$ = LEFT\$(as\$, ix - 1) + MID\$(as\$, ix + 1)
NEXT
IF good THEN
PRINT a; b; c; d
EXIT FOR
END IF
NEXT a
IF good THEN EXIT FOR
NEXT c

FOR c = 2 TO 9999
FOR a = 1 TO c / 2
b = c - a
d = b + c
as\$ = LTRIM\$(STR\$(a))
ds\$ = LTRIM\$(STR\$(d))
good = 1
FOR i = 1 TO LEN(ds\$)
ix = INSTR(as\$, MID\$(ds\$, i, 1))
IF ix = 0 THEN good = 0: EXIT FOR
as\$ = LEFT\$(as\$, ix - 1) + MID\$(as\$, ix + 1)
NEXT
IF good THEN
e = c + d
bs\$ = LTRIM\$(STR\$(b))
es\$ = LTRIM\$(STR\$(e))
FOR i = 1 TO LEN(es\$)
ix = INSTR(bs\$, MID\$(es\$, i, 1))
IF ix = 0 THEN good = 0: EXIT FOR
bs\$ = LEFT\$(bs\$, ix - 1) + MID\$(bs\$, ix + 1)
NEXT
IF good THEN
PRINT a; b; c; d; e
EXIT FOR
END IF
END IF
NEXT a
IF good THEN EXIT FOR
NEXT c

FOR c = 2 TO 9999
FOR a = 1 TO c / 2
b = c - a
d = b + c
as\$ = LTRIM\$(STR\$(a))
ds\$ = LTRIM\$(STR\$(d))
good = 1
FOR i = 1 TO LEN(ds\$)
ix = INSTR(as\$, MID\$(ds\$, i, 1))
IF ix = 0 THEN good = 0: EXIT FOR
as\$ = LEFT\$(as\$, ix - 1) + MID\$(as\$, ix + 1)
NEXT
IF good THEN
e = c + d
bc\$ = LTRIM\$(STR\$(b)) + LTRIM\$(STR\$(c))
de\$ = ds\$ + LTRIM\$(STR\$(e))
FOR i = 1 TO LEN(de\$)
ix = INSTR(bc\$, MID\$(de\$, i, 1))
IF ix = 0 THEN good = 0: EXIT FOR
bc\$ = LEFT\$(bc\$, ix - 1) + MID\$(bc\$, ix + 1)
NEXT
IF good THEN
PRINT a; b; c; d; e
EXIT FOR
END IF
END IF
NEXT a
IF good THEN EXIT FOR
NEXT c

`  A     B     C     D     E15    18    33    511458  1845  3303  5148  84511242  1440  2682  4122  6804`

 Posted by Charlie on 2013-11-12 18:52:56

 Search: Search body:
Forums (0)