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

Home > Numbers
Consecutive Additions (Posted on 2013-11-12) Difficulty: 3 of 5
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?

3. What if instead we add A+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.)
Solution 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

Finds the three answers:

  A     B     C     D     E
15  18  33   51
1458  1845  3303  5148  8451
1242  1440  2682  4122  6804

  Posted by Charlie on 2013-11-12 18:52:56
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information