row of closed lockers, numbered from 1 to 1024
Source: Chile Finals 2006 L2 p5
October 3, 2022
combinatorics
Problem Statement
A bored student walks down a hallway where there is a row of closed lockers, numbered from to . Opens cabinet No. , then skips one cabinet and opens the next, and so on successively. When he reaches the end of the row, he turns around and starts again: he opens the first cabinet it finds closed, he skips the next closed cabinet and so on until the start from the hallway. goes from beginning to end, from end to beginning of the corridor until all the cabinets are left open. What is the number of the last cabinet he opened?