Press the green flag. Opened for an odd number of factors. Closed for an even number of factors.
I made a program that solves for the following problem, which was asked in a job interview at Coinbase: There are 100 lockers in a row. They're all closed. A kid goes by. He opens every single locker. A second kid goes by. Now he closes every other locker, every second locker. Third kid comes by, every third locker. If it's open, he closes it. If it's closed, he opens it. Then the fourth kid goes by. Every fourth locker, he changes the state. And now 100 kids go by. What is the state of the lockers after 100 kids go by?