BrainDen.com - Brain Teasers
• 0

# Bug Riddle

## Question

Suppose you have 10 boxes, and there is a bug in one of the boxes.

Every time you open a box, the bug moves from one box to another (either left or right).

How can we find the bug?

## Recommended Posts

• 0

Here’s one way, there may be a quicker one.

start at 1, open them one at a time up through 10. Then hit 10 again, and go back one by one to 1.

Heres my argument:

The bug is in one of two states:
(a) box number same parity as time number, such as box 3 at time 1, or box 2 at time 4, OR

(b) box number opposite parity as time number, such as box 4 at time 1, or box 2 at time 3

The proposed approach is to spend the first 10 times in state (a), then, by taking two time units in box 10, we switch to state (b) and come back to 1.

If he was in state (a), then we would have found him on the forward pass, but if he was in state (b) we will find him in the backward pass.

For example, if he is in box 2 at time 1 (state b) when we open box 1, we miss him. At time 2 he could move to box 1 or 3, and we miss him again. By time 10, when we are opening box 10, he can be in any odd box. For example, he might be in 9. At time 11, we open 10 again. The bug either moves to 10 (and we catch him) or he moves to 8. So we move to 9 and he moves either to 9 ( and we catch him), or to 7. As we continue back, we are always an even distance from the bug, including 0. This can continue until we open 4 while he was in 2. When we move to 3 he either moves to 3 (and we catch him), or he moves to 1. In that case, we move to 2 and he has to move to 2 (and we catch him).

On the other hand, if he is in State (a) when we start (also in state a), then we are an even distance from him, and we will catch him by time 10.

There was a brainden puzzle with a video that reminds me of this puzzle. Look for “Fox in a Hole”)

Edited by CaptainEd
Found a similar puzzle
##### Share on other sites
• 0

To find the bug the number of boxes between the box that u opened already and the box that the bug exists should be an odd number .

When ever u move to another box and  then bug also moves to other box then the number of boxes between your box and rat box should add up to two or zero. The nature of number of boxes remains same (if odd it remains odd if even remains even)

So now start from 1 and go to 10 definitely there is a crossing point of u and bug. if not occurs  then intially u and bug are differ by even number of boxes so when u reaches 10 open the box 10 again then now the number of boxes that u and bug separated by an odd number of boxes so now move to number 1 box backward and there will be a point of crossing .u will find a bug .

##### Share on other sites
• 0
Spoiler

2,3,4,5,6,7,8,9,9,8,7,6,5,4,3,2 should do it.  16 checks to get the bug.

I went and found the first time I encountered this puzzle: http://brainden.com/forum/topic/11943--/

Here's my additional puzzles on the same theme: http://brainden.com/forum/topic/12010--/

I just thought of an additional one... will post shortly :)

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.