top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

Puzzle: n bulbs in a circle

+2 votes
286 views

There are n bulbs in a circle, each bulb has one switch associated with it, on operating the switch, it toggles the state of the corresponding bulb as well as two bulbs adjacent to that one. Given all bulbs are in off state initially, give a plan to turn all bulbs on finally. (Given n >= 1)

posted Nov 8, 2013 by Salil Agrawal

Share this puzzle
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

The idea is to check the value of n%3, there can be three cases
Case 1: when n%3 = 0, bulbs are complete multiple of 3

This is the simplest case, here assume n/3 pairs of bulbs and operate the middle bulb from each pair, ultimately all n bulbs will be on.

Case 2: when n%3 = 1, case 1 + one extra bulb

In this case, if we reach to a state where only one bulb is on and remaining n-1 bulbs are off, we can turn on remaining n-1 bulbs easily as (n-1) is complete multiple of 3.

Lets assume n =7, and do as described in step 1 to 5.

Step 1: Toggle bulbs in pair of 3, 2nd, 5th, till n-2th bulb. at this stage only nth bulb will be off and rest all will be in on state.

Step 2: Toggle 1st bulb, it will make 1st and 2nd bulb off and nth bulb(7th for our example) ON.

Step 3: Toggle 3rd bulbs, it will make 1st, 2nd and 4th bulbs off and remaining bulbs ON.

Step 4: Leave 1st,2nd,3rd and 4th bulbs as it is and turn off remaining (n-4) bulbs in pair of 3′s. as (n-4) is complete power of 3 this can be done easily as in case 1. after this only 2nd bulbs will be ON.

Step 5: Leave 2nd bulb and turn on remaining (n-1) bulbs in pair of 3′s, again as (n-1) is complete multiple of 3, this can be done easily as in case 1. at this point all bulbs will be ON.

Case 3: when n%3 = 2, case 1 + two extra bulbs

In this case, if we reach to a state where only two bulbs are on and remaining n-2 bulbs are off, we can turn on remaining n-2 bulbs easily as (n-2) is complete multiple of 3.

Lets assume n =8, and do as described in step 1 to 5.

Step 1: Toggle bulbs in pair of 3, 2nd, 5th, till (n-3)th bulb. at this stage only nth and (n-1)th bulbs will be off and rest all will be in on state.

Step 2:Toggle nth bulb, (8th for our case), this will leave only 1st bulb off, rest all ON.

Step 3: Leave 1st and nth bulb and turn off remaining (n-2) bulbs in pair of 3′s, as (n-2) is complete multiple of 3

Step 4: Toggle nth bulb again, this will turn on 1st and 2nd bulb and remaining all will be off.

Step 5: Leave 1st and 2nd bulb and turn on remaining (n-2) bulbs in pair of 3′s, as (n-2) is a complete power of 3, it can be done easily as in case 1.

Source: http://puzzlersworld.com/interview-puzzles/n-bulbs-in-a-circle-puzzle/#more-2917

answer Nov 8, 2013 by Garima Jain
Case 3:
In step 3, you didn't mention that 1st bulb is already off. So, only nth bulb is on after this step.
1st bulb should be toggled in step 4, not the nth one.



Similar Puzzles
0 votes

Can you solve the below Clocks Calculators Bulbs Brain Teaser?

enter image description here

+2 votes

Name the thing which comes once in a year?, thrice in a month? and 8 times in a day?

0 votes

Identify The Places In Kozhikode (India) Emoji Puzzle.

enter image description here

+2 votes

Can you find the Cat in the picture puzzle.

enter image description here

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...