We play! The game of the five balls and the three openings

Logic Level 3

For a game a tube containing five balls numbered from 1 to 5 is used. It has three openings A and B at the ends and C in the middle at the top, as shown.

Game rules:

1) You can take a ball through the opening B and enter it by A, moving the other balls to the right.

2) You can take a ball through the opening B and enter it by C, moving the last two balls to the right.

If initially the balls are in position 12345, what is the minimum number of moves needed to reach position 25413?


Example: Suppose that at some point the balls are in position 14352 there are two possible moves:

  • Take the 2 ball by B and enter it by A, remaining as new position 21435.
  • Take the 2 ball by B and enter it by C, remaining as new position 14235.
1 3 5 More than 5 moves 4 2

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Stephen Mellor
Dec 28, 2017

One such solution:

12345

12534

41253

41325

54132

25413

How can we justify that 5 is indeed the minimum no of steps needed??

Aaghaz Mahajan - 3 years, 5 months ago

Log in to reply

If we look at the final required position, it is obvious that the last ball to be moved is either 2 or 4. However, balls are only removed at B. Therefore the first ball moved is definitely 5, followed by a 4. It is obvious that the 2 must be moved to the front, so at least 4 moves are needed (5,4,3,2) to move it to the front. For it to be done in 4 moves, the 5 ball must be moved to A (as placing it at C would shunt the 2 ball further down the line). However, this creates a '51' combo, which isn't in the required end position. Going round to get rid of it would take more than 4 moves. Therefore, the lower bound is 5.

Stephen Mellor - 3 years, 5 months ago
Atishay Jain
Jan 2, 2018

Possible positions at every step are:-

(i) 51234 , 12534 51234, 12534

(ii) 45123 , 51423 , 41253 , 12453 45123, 51423, 41253, 12453

(iii) 34512 , 45312 , 35142 , 51342 , 34125 , 41325 , 31245 , 12345 34512, 45312, 35142, 51342, 34125, 41325, 31245, 12345

(iv) 23451 , 34215 , 24531 , 45231 , 23514 , 35214 , 25134 , 51234 , 53412 , 34512 , 54132 , 41532 , 53124 , 31524 , 51234 , 12534 23451, 34215, 24531, 45231, 23514, 35214, 25134, 51234, 53412, 34512, 54132, 41532, 53124, 31524, 51234, 12534

(v) 12345 , 23145 , 53421 , 34521 , 12453 , 24153 , 14523 , 45123 , 42351 , 23415 , 43521 , 35421 , 42513 12345, 23145, 53421, 34521, 12453, 24153, 14523, 45123, 42351, 23415, 43521, 35421, 42513 , 25413 , 45123 , 51423 , 25341 , 53214 , 23451 , 34251 45123, 51423, 25341, 53214, 23451, 34251 , 25413 , 54213 , 24153 , 41253 , 45312 , 53412 , 43152 , 31452 , 45123 , 51423 , 41253 , 12453 54213, 24153, 41253, 45312, 53412, 43152, 31452, 45123, 51423, 41253, 12453

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...