I found that if n has an even number of factors than the nth locker would be open at the end and if not, it would be closed at the end. I did this by trying trial and error for the first 10 lockers and 10 people. Then, by looking at that I realized that the lockers changed states when the locker number mod the person number was 0 so it changed when the locker number is divisible by the person number. When it changed an even number of times it would end up open. When it changed an odd number of times it would end up even. So, it is dependent on whether the locker has an even or odd number of factors. I added a picture of what I wrote as I was thinking through this.
No comments:
Post a Comment