This is a programmatic solution to my daughter's math homework problem:
- There are 100 lockers, all closed.
- Person #1 opens every locker.
- Person #2 flips (opens if closed, closes if open) every other locker
- Person #3 flips every 3rd locker ...
- Person #n flips every nth locker
After person #100 finishes, which lockers are open?
You'll find the solution very curious.
We've taken 2 approaches to it so far. One brute force, and a second one that tests a theory.