That's the clever solution. Here's a solution that is actually brute force, but tries to fake being clever: http://www.tzs.net/lights.html
PS: I have not updated that page in years, which is why it contains a link to a Dutch noodle seller. It was a link to an online game service back when I wrote the page.
PS: I have not updated that page in years, which is why it contains a link to a Dutch noodle seller. It was a link to an online game service back when I wrote the page.