Six brothers Al, Bob, Cal, Don, Elmer and Fred always take the same seat when they have their meals in the circular dinner table. The following figure displays their seat numbers.
1
6 2
5 3
4
The following is known:
 Bob's seat number is precisely 1 larger than that of Elmer's seat number.
 The seat of Don is separated from Al's seat by precisely one of the other brothers.
 Al's seat number is either 1 larger than or 1 smaller than Fred's seat number.
 The absolute difference of Cal's seat number from that of Bob's and the absolute difference of Cal's seat number from that of Don's are respectively either, 2 and 5; or, 5 and 2.
Determine the respective seat numbers of the six brothers.
DECLARE SUB permute (a$)
CLS
o$ = "abcdef": h$ = o$
DO
bob = INSTR(o$, "b")
elmer = INSTR(o$, "e")
IF bob = elmer + 1 THEN
don = INSTR(o$, "d")
al = INSTR(o$, "a")
IF ABS(don  al) = 2 OR ABS(don  al) = 4 THEN
fred = INSTR(o$, "f")
IF ABS(al  fred) = 1 THEN
cal = INSTR(o$, "c")
cb = ABS(cal  bob)
cd = ABS(cal  don)
IF cb = 2 AND cd = 5 OR cb = 5 AND cd = 2 THEN
PRINT o$
END IF
END IF
END IF
END IF
permute o$
LOOP UNTIL o$ = h$
(the permute subroutine is elsewhere on the site)
The order of the brothers' initials positioned by seat number is:
cebafd

Posted by Charlie
on 20090525 16:15:01 