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

Home > Numbers
Vicious Circle (Posted on 2007-01-17) Difficulty: 3 of 5
Joe's latest puzzle for Penny consists of nine consecutively numbered pegs and a disc with 10 holes. The disc is free to rotate about its center.

The top position of the circle at any given time is marked by a fixed arrow pointer. A peg may be inserted in the disc in an empty hole adjacent to the arrow. If that hole isn't empty, she can't continue placing pegs.

The pegs are numbered, and after each one is placed, the disc is rotated that many positions clockwise. Penny has succeeded in placing all the pegs in the holes on the disc and has left an empty spot at the top adjacent to the arrow pointer, as shown in the following diagram. I've marked the empty spot that remains, with a hyphen:


                 |
                 V

                 -

       1                   9



 z                               x





 7                               2



       3                   8

                 y
                 

But Penny doesn't remember in which of the positions marked x, y and z were the 4, 5 and 6 at the end of the game.

In what order did Penny place the pegs?

  Submitted by Charlie    
Rating: 5.0000 (1 votes)
Solution: (Hide)
We know that the sequence included 8, 3, 2, 9, and that x followed the 9. We also know that 7 was the last peg placed, as that left at the top the hole that's currently there. So in the following program, 8 stands for the whole sequence 8329:

DECLARE SUB place (p$)
DECLARE SUB permute (a$)
CLS
DIM SHARED d$, flag

a$ = "14568": h$ = a$
DO
  d$ = SPACE$(10): flag = 0
  FOR i = 1 TO 5
   IF MID$(a$, i, 1) = "8" THEN
     place "8"
     place "3"
     place "2"
     place "9"
   ELSE
     place MID$(a$, i, 1)
   END IF
   IF flag THEN EXIT FOR
  NEXT
  place "7"
  IF flag = 0 THEN PRINT a$; "    "; d$
  permute a$
LOOP UNTIL a$ = h$

END

SUB place (p$)
 IF MID$(d$, 1, 1) > " " THEN flag = 1: EXIT SUB
 MID$(d$, 1, 1) = p$
 rot = VAL(p$)
 psn = 11 - rot
 d$ = MID$(d$, psn) + LEFT$(d$, psn - 1)
END SUB

The results show as:

placement   final pos
            | 
            V
56148       63 4159728
56841       694285371
61485        952863741
65841        942863715

where the left set of numbers is the sequence of placement and the right set shows the result, starting with the top and going clockwise.

The first two rows leave a 6 at the top, rather than a blank. Only the third line matches the numbered positions, and so the sequence of placed pegs was 6, 1, 4, 8, 3, 2, 9, 5, 7 (since 8 represents 8329, and 7 is understood at the end). By the way, x=5, y=6 and z=4, shown in positions on the right side of line 3.

From Enigma No. 1421 by Bob Walker, New Scientist, 9 December 2006.

Comments: ( You must be logged in to post comments.)
  Subject Author Date
Puzzle Thoughts K Sengupta2023-07-16 02:52:13
SolutionSolutionPenny2007-01-20 23:26:46
I thiiiinkTamTam2007-01-17 15:01:23
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (21)
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