A lightbulb is turned on by one of three switches, but you cannot see the bulb from the switches. How can you determine which switch turns on the bulb if you only want to go from the switches to the bulb once?

Assume that the switches are clearly marked indicating which orientation is on, that the lightbulb is an ordinary household incandescent bulb, that you do not have assistants or apparatus such as mirrors available, and in general that this is not a trick question.

Can you solve it for four switches?

Three Switches Solution

lib/config.php:156: Notice: Undefined variable: accept

lib/DbaDatabase.php:134: Warning: dba_replace() [<a href='function.dba-replace'>function.dba-replace</a>]: You cannot perform a modification to a database without proper access