PuzzlersWorld.com

  • Hacker Puzzle
  • Interview Puzzles
  • Number Puzzles
  • Maths Puzzles

n bulbs in a circle puzzle

(2 votes, average: 3.00 out of 5)

September 14, 2013 by puzzler 7 Comments

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.

Note: n >= 1.


Click here to see the planHide Solution
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.

n bulbs in a circle puzzle solution case 1

n bulbs in a circle puzzle solution case 1

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.

n bulbs in a circle puzzle solution case 2

n bulbs in a circle puzzle solution case 2

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.

n bulbs in a circle puzzle solution case 3

n bulbs in a circle puzzle solution case 3

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.

  • Share on Whatsapp
  • Share on Facebook
  • Share on Twitter
Facebook Comments
Next Puzzle
4 bottles and water puzzle

Checkout more Interview Puzzles Tags: Solved Puzzles, Very Difficult

Comments

  1. jack says

    April 28, 2016 at 3:27 pm

    switch alternative bulbs at certain point of time all bulbs will be in on state.

    Reply
  2. Arun Srinivaas says

    March 10, 2014 at 9:43 am

    It works only when n is multiples of 3. Note that switching one will toggle the state of adjacent. So if the adjacent is already on, it will switch it off.

    Reply
  3. Qasim says

    February 20, 2014 at 11:54 am

    n/3 if n is divisible by 3 else n steps are required….:)

    Reply
  4. Qasim says

    February 20, 2014 at 11:31 am

    n/3 if n is divisible by 3 else (n/3)+1 for every n > 3….

    Reply
  5. മൂസ Moosa says

    January 17, 2014 at 10:47 pm

    “There are n bulbs in a circle,”

    —
    “in a circle” ?? i would have assumed the bulbs are inside the circle based on that

    Reply
  6. Omkar says

    November 9, 2013 at 6:30 pm

    Simplest solution:
    1, 2, 3, 4, 5, …, n

    Dont believe? just try it.

    Reply
  7. sonal jha says

    September 25, 2013 at 6:51 am

    There is a simpler solution, if n is a multiple of 3 do it as done by author, first 1 the 1+3=4 then 4+3=7 and so on upto n/3 the number of steps taken will be n/3
    otherwise, start from bulb number 1 and keep switching it on till the last bulb i.e switch on 1, then 2 then 3 and so on upto n, it will take n steps and all bulbs will be in the on state finally
    (The solution given by author is also taking n steps in both the cases n=7 and n=8 if you observe closely)

    Reply

Leave a Comment Cancel reply

Submit your Puzzle

You may also like

  • Wires on fire
  • 100 floors with 2 eggs puzzle
  • 10 black socks and 10 white socks puzzle
  • 100 people with sword puzzle
  • Red and blue marbles
  • Lie tribe and Truth tribe
  • Balls in a bag
  • n bulbs in a circle puzzle
  • 100 doors
  • Heavier ball

Categories

  • Aive hi Puzzles
  • Akbar and Birbal
  • Alphabetical Puzzles
  • Bollywood Puzzles
  • Google Code jam
  • Hindi Riddles
  • Interview Puzzles
  • Interview Questions
  • Logical Puzzles
  • Malayalam Puzzles
  • Maths Puzzles
  • Miscellaneous
  • Number Puzzles
  • Picture Puzzles
  • Riddles
  • Tamil Puzzles
  • Technical

Social

  • View puzzlersworld’s profile on Twitter
privacy policy

Copyright © 2023 · eleven40 Pro Theme on Genesis Framework · WordPress · Log in

  • Hacker Puzzle
  • Logo Puzzles
  • Optical Illusions
  • WhatsApp Puzzles
  • Picture Puzzles
  • Riddles
    ▼
    • Hindi Riddles
  • Bollywood Puzzles
  • Alphabetical Puzzles
  • Aive hi Puzzles
  • Interview Puzzles
  • Logical Puzzles
  • Interview Questions
    ▼
    • Data Structures
    • Binary Tree
    • Algorithms
    • Recursion Questions
    • Amazon Interview Questions
    • Snapdeal Interview Questions
    • Google Code jam
  • Technical
  • Akbar and Birbal
  • Number Puzzles
  • Maths Puzzles
  • Miscellaneous