{"id":4462,"date":"2025-07-12T12:42:39","date_gmt":"2025-07-12T16:42:39","guid":{"rendered":"https:\/\/josmfs.net\/?p=4462"},"modified":"2025-07-12T12:42:39","modified_gmt":"2025-07-12T16:42:39","slug":"100-light-bulbs-puzzle","status":"publish","type":"post","link":"https:\/\/josmfs.net\/wordpress\/2025\/07\/12\/100-light-bulbs-puzzle\/","title":{"rendered":"100 Light Bulbs Puzzle"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft  wp-image-4459\" src=\"https:\/\/josmfs.net\/wordpress\/wp-content\/uploads\/2025\/07\/100-Light-Bulbs-Fig2.jpg\" alt=\"\" width=\"200\" height=\"162\" srcset=\"https:\/\/josmfs.net\/wordpress\/wp-content\/uploads\/2025\/07\/100-Light-Bulbs-Fig2.jpg 398w, https:\/\/josmfs.net\/wordpress\/wp-content\/uploads\/2025\/07\/100-Light-Bulbs-Fig2-300x243.jpg 300w\" sizes=\"auto, (max-width: 200px) 100vw, 200px\" \/>This is a classic <a href=\"https:\/\/mindyourdecisions.com\/blog\/2025\/05\/30\/100-light-bulbs-puzzle-2\/\">puzzle<\/a> from Presh Talwalkar.<\/p>\n<p>\u201cThis puzzle has been asked as an interview question at tech companies like Google.<\/p>\n<p>There are 100 lights numbered 1 to 100, all starting in the off position. There are also 100 people numbered 1 to 100. First, person 1 toggles every light switch (toggle means to change from off to on, or change from on to off). Then person 2 toggles every 2nd light switch, and so on, where person <em>i<\/em> toggles every <em>i<\/em><sup>th<\/sup> light switch. The last person is person 100 who toggles every 100th switch.<\/p>\n<p>After all 100 people have passed, which light bulbs will be turned on?\u201d<\/p>\n<p>I vaguely remembered the answer, which I confirmed after a few examples. But I didn\u2019t remember an exact proof, so I thought I would give it a try.<\/p>\n<p><a href=\"https:\/\/josmfs.net\/wordpress\/wp-content\/uploads\/2025\/07\/100-Light-Bulbs-Answer.jpg\">Answer<\/a>.<\/p>\n<p>See <a href=\"https:\/\/josmfs.net\/wordpress\/wp-content\/uploads\/2025\/07\/100-Light-Bulbs-Puzzle-250602.pdf\">100 Light Bulbs Puzzle<\/a> for solutions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a classic puzzle from Presh Talwalkar. \u201cThis puzzle has been asked as an interview question at tech companies like Google. There are 100 lights numbered 1 to 100, all starting in the off position. There are also 100 people numbered 1 to 100. First, person 1 toggles every light switch (toggle means to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[133,17],"class_list":["post-4462","post","type-post","status-publish","format-standard","hentry","category-puzzles-and-problems","tag-algebra","tag-presh-talwalkar"],"_links":{"self":[{"href":"https:\/\/josmfs.net\/wordpress\/wp-json\/wp\/v2\/posts\/4462","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/josmfs.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/josmfs.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/josmfs.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/josmfs.net\/wordpress\/wp-json\/wp\/v2\/comments?post=4462"}],"version-history":[{"count":1,"href":"https:\/\/josmfs.net\/wordpress\/wp-json\/wp\/v2\/posts\/4462\/revisions"}],"predecessor-version":[{"id":4463,"href":"https:\/\/josmfs.net\/wordpress\/wp-json\/wp\/v2\/posts\/4462\/revisions\/4463"}],"wp:attachment":[{"href":"https:\/\/josmfs.net\/wordpress\/wp-json\/wp\/v2\/media?parent=4462"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/josmfs.net\/wordpress\/wp-json\/wp\/v2\/categories?post=4462"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/josmfs.net\/wordpress\/wp-json\/wp\/v2\/tags?post=4462"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}