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

Home > Numbers
Pandigital Sum (Posted on 2006-09-19) Difficulty: 3 of 5
Find a 2-digit integer, a 3-digit integer and a 4-digit integer, such that:
  • among them contain all digits 1 - 9
  • each integer is divisible by each of its digits
  • the sum of the three integers is a 4-digit number that is also divisible by each of its digits, which are all different as well
  •   Submitted by Charlie    
    Rating: 5.0000 (1 votes)
    Solution: (Hide)
    The 2-, 3- and 4-digit numbers that are divisible by each of their digits are:

     12        124       1236      3915
     15        126       1248      3924
     24        128       1296      4128
     36        132       1326      4172
     48        135       1362      4236
               162       1368      4368
               168       1395      4392
               175       1632      4632
               184       1692      4872
               216       1764      4896
               248       1824      4932
               264       1926      4968
               312       1935      6132
               315       1962      6192
               324       2136      6312
               384       2184      6324
               396       2196      6384
               412       2316      6432
               432       2364      6912
               612       2436      6984
               624       2916      8136
               648       3126      8496
               672       3162      8736
               728       3168      9126
               735       3195      9135
               784       3216      9162
               816       3264      9216
               824       3276      9315
               864       3492      9324
               936       3612      9432
                         3624      9612
                         3648      9648
                         3816      9864
                         3864
    

    The solution is:

    48 + 672 + 3195 = 3915

    DIM num(2 TO 4, 80)
    col = 1: row = 1: pLen = 2
    CLS
    FOR i = 12 TO 9876
     n$ = LTRIM$(STR$(i))
     good = 1
     FOR j = 1 TO LEN(n$)
       d$ = MID$(n$, j, 1)
       IF INSTR(MID$(n$, j + 1), d$) THEN good = 0: EXIT FOR
       IF d$ = "0" THEN good = 0: EXIT FOR
       IF i MOD VAL(d$) <> 0 THEN good = 0: EXIT FOR
     NEXT
     IF good THEN
      pCt = pCt + 1
      IF LEN(n$) > pLen THEN col = col + 1: row = 1: pCt = 1
      num(LEN(n$), pCt) = i
      howMany(LEN(n$)) = pCt
      LOCATE row, col * 10 - 9
      PRINT i; : ct = ct + 1
      row = row + 1
      IF row > 34 THEN row = 1: col = col + 1
      pLen = LEN(n$)
     END IF
    NEXT
    PRINT ct
    LOCATE 38, 1
    
    FOR a = 1 TO howMany(2)
    FOR b = 1 TO howMany(3)
    FOR c = 1 TO howMany(4)
     b$ = LTRIM$(STR$(num(2, a))) + LTRIM$(STR$(num(3, b))) + LTRIM$(STR$(num(4, c)))
     good = 1
     FOR i = 1 TO LEN(b$) - 1
      IF INSTR(MID$(b$, i + 1), MID$(b$, i, 1)) THEN good = 0: EXIT FOR
     NEXT
     IF good THEN
       dVal = num(2, a) + num(3, b) + num(4, c)
       good = 0
       FOR i = 1 TO howMany(4)
         IF dVal = num(4, i) THEN good = 1: EXIT FOR
       NEXT
       IF good THEN PRINT num(2, a); num(3, b); num(4, c); dVal
     END IF
    
    NEXT
    NEXT
    NEXT
    
    

    From New Scientist, 19 August 2006, Enigma number 1405.

    Comments: ( You must be logged in to post comments.)
      Subject Author Date
    SolutionNumbersMath Man2017-03-10 14:25:06
    answerK Sengupta2008-11-24 00:45:17
    re(2): SolutionPenny2006-09-19 10:15:26
    re: Solutionbumble2006-09-19 08:30:29
    SolutionSolutionPenny2006-09-19 07:54:02
    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 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information