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

Home > Numbers
Neighboring Multiples (Posted on 2009-03-15) Difficulty: 3 of 5
Place the digits 1 through 9 in a 3x3 array so that the numbers surrounding each digit (including those adjacent by a diagonal) add to a multiple of that digit.

As an example of an array that fails in this regard, take:

  9 5 1
  6 7 2
  4 3 8
 

While 6+7+5=18 is in fact a multiple of the 9 that it surrounds, as required, the 2+7+3=12 that surrounds the 8 is not a multiple of 8, so this grid fails (it also fails based on the surrounds of 6 and 7).

  Submitted by Charlie    
No Rating
Solution: (Hide)
All the rotations and reflections of the one solution are shown below:

 2  6  5
 7  3  1
 9  8  4

 2  7  9
 6  3  8
 5  1  4

 4  1  5
 8  3  6
 9  7  2

 4  8  9
 1  3  7
 5  6  2

 5  1  4
 6  3  8
 2  7  9

 5  6  2
 1  3  7
 4  8  9

 9  7  2
 8  3  6
 4  1  5

 9  8  4
 7  3  1
 2  6  5
 
 CLS
 e = 3: GOSUB try
 e = 5: GOSUB try
 e = 9: GOSUB try
 END
 
 try:
   taken(e) = 1
 
   FOR a = 1 TO 9
    IF taken(a) = 0 THEN
      taken(a) = 1
   FOR b = 1 TO 9
    IF taken(b) = 0 THEN
      taken(b) = 1
   FOR c = 1 TO 9
    IF taken(c) = 0 THEN
      taken(c) = 1
   FOR d = 1 TO 9
    IF taken(d) = 0 AND (b + d + e) MOD a = 0 THEN
      taken(d) = 1
   FOR f = 1 TO 9
    IF taken(f) = 0 AND (b + e + f) MOD c = 0 _
     AND (a + c + d + e + f) MOD b = 0 THEN
      taken(f) = 1
   FOR g = 1 TO 9
    IF taken(g) = 0 THEN
      taken(g) = 1
   FOR h = 1 TO 9
    IF taken(h) = 0 AND (d + e + h) MOD g = 0 THEN
      taken(h) = 1
   FOR i = 1 TO 9
   
    IF taken(i) = 0 AND (h + e + f) MOD i = 0 _
       AND (b + c + e + h + i) MOD f = 0 _
       AND (g + d + e + f + i) MOD h = 0 _
       AND (a + b + e + g + h) MOD d = 0 THEN
      taken(i) = 1
 
      PRINT a; b; c:
      PRINT d; e; f:
      PRINT g; h; i:
      PRINT
 
      taken(i) = 0
    END IF
   NEXT
      taken(h) = 0
    END IF
   NEXT
      taken(g) = 0
    END IF
   NEXT
      taken(f) = 0
    END IF
   NEXT
      taken(d) = 0
    END IF
   NEXT
      taken(c) = 0
    END IF
   NEXT
      taken(b) = 0
    END IF
   NEXT
      taken(a) = 0
    END IF
   NEXT
 
   taken(e) = 0
 RETURN
 

From Giant Book of Mensa Mind Challenges, edited by Todd Johnson, Section 3: "Nearly Impossible Brain Bafflers", page 197.

Comments: ( You must be logged in to post comments.)
  Subject Author Date
Puzzle Answer K Sengupta2023-08-20 22:28:48
SolutionComputer solutionRobby Goetschalckx2009-03-15 14:08:44
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 (18)
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