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

Home > Logic
Color Coded Cards (Posted on 2007-10-17) Difficulty: 3 of 5
Nine cards, each of a different color and each with a different digit 1 - 9 have been arranged in a circle.

All except the gray card are between an odd digit and an even digit.

The hazel, indigo, jade and khaki cards are consecutive in that order clockwise around the circle, with the digits on the first three adding to give the digit on the fourth.

The lime, magenta and navy cards are consecutive in that order clockwise around the circle, with the digits on the first two summing to give twice the digit on the third.

There is also an orange card.

In some cases the digit on a card equals the sum of the digits on the neighboring two cards. The number of occurrences of this situation is the digit on the hazel card.

Starting with the "1", what are the numbers on, and colors of, the cards, clockwise around the circle?

  Submitted by Charlie    
Rating: 3.5000 (4 votes)
Solution: (Hide)
1  3  2  4  9  5  8  6  7
g  h  i  j  k  o  l  m  n

DECLARE FUNCTION try! (p1!, p2!, p3!, p4!, p5!, p6!, p7!, p8!, p9!, h!)
DIM taken(50)
FOR g = 1 TO 9 STEP 2
 taken(g) = 1

FOR h = 1 TO 9
 IF taken(h) = 0 THEN
  taken(h) = 1

FOR i = 1 TO 9
 IF taken(i) = 0 THEN
  taken(i) = 1

FOR j = 1 TO 9
 IF taken(j) = 0 THEN
  taken(j) = 1
  IF (h + j) MOD 2 = 1 THEN

k = h + i + j
IF k < 10 AND taken(k) = 0 THEN
 taken(k) = 1

FOR l = 1 TO 9
 IF taken(l) = 0 THEN
  taken(l) = 1

FOR m = 1 TO 9
 IF taken(m) = 0 THEN
  taken(m) = 1

IF (l + m) MOD 2 = 0 THEN
  n = (l + m) / 2
  IF taken(n) = 0 AND (l + n) MOD 2 = 1 THEN
    taken(n) = 1

    FOR o = 1 TO 9
      IF taken(o) = 0 THEN
       ord$ = \\"g hijk lmn o\\"
       IF try(g, h, i, j, k, l, m, n, o, 2) THEN GOSUB reportIt
       ord$ = \\"g hijk o lmn\\"
       IF try(g, h, i, j, k, o, l, m, n, 2) THEN GOSUB reportIt
       ord$ = \\"g lmn hijk o\\"
       IF try(g, l, m, n, h, i, j, k, o, 5) THEN GOSUB reportIt
       ord$ = \\"g lmn o hijk\\"
       IF try(g, l, m, n, o, h, i, j, k, 6) THEN GOSUB reportIt
       ord$ = \\"g o hijk lmn\\"
       IF try(g, o, h, i, j, k, l, m, n, 3) THEN GOSUB reportIt
       ord$ = \\"g o lmn hijk\\"
       IF try(g, o, l, m, n, h, i, j, k, 6) THEN GOSUB reportIt
      

      END IF
    NEXT

    taken(n) = 0
  END IF
END IF

  taken(m) = 0
 END IF
NEXT m

  taken(l) = 0
 END IF
NEXT l

 taken(k) = 0
END IF

  END IF
  taken(j) = 0
 END IF
NEXT j

  taken(i) = 0
 END IF
NEXT i

  taken(h) = 0
 END IF
NEXT h

 taken(g) = 0
NEXT

PRINT ct

END

reportIt:
        PRINT ord$
        ct = ct + 1
RETURN

FUNCTION try (p1, p2, p3, p4, p5, p6, p7, p8, p9, h)
 DIM p(9)
 p(1) = p1
 p(2) = p2
 p(3) = p3
 p(4) = p4
 p(5) = p5
 p(6) = p6
 p(7) = p7
 p(8) = p8
 p(9) = p9
 good = 1
 IF (p2 + p9) MOD 2 = 1 THEN good = 0
 IF (p8 + p1) MOD 2 = 0 THEN good = 0
 IF good THEN
   FOR i = 1 TO 7
     IF (p(i) + p(i + 2)) MOD 2 = 0 THEN good = 0: EXIT FOR
   NEXT
 END IF
 IF good THEN
   tot = 0
   IF p1 = p2 + p9 THEN tot = 1
   IF p9 = p8 + p1 THEN tot = tot + 1
   FOR i = 2 TO 8
     IF p(i) = p(i - 1) + p(i + 1) THEN tot = tot + 1
   NEXT
   IF p(h) <> tot THEN good = 0
 END IF
 IF good THEN
   FOR i = 1 TO 9
     PRINT p(i);
   NEXT
   PRINT
 END IF
 try = good
END FUNCTION

resulting in:

1 3 2 4 9 5 8 6 7
g hijk o lmn
1 solution

(program designed to start with the gray, fortuitously the card with the "1")

From Enigma No. 1460, by Susan Denham, New Scientist, 15 September 2007

Comments: ( You must be logged in to post comments.)
  Subject Author Date
SolutionNo SubjectAhmed2007-10-19 11:27:09
SolutionSolutionDej Mar2007-10-17 11:10:36
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