
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
A bored student walks down a hallway containing a row of closed lockers, numbered from $1$ to $512$. The student opens every second locker starting with locker number 1. On reaching the end, the student turns around and starts back, this time opening every second closed locker until he reaches the beginning. The student repeats this process, each time switching direction and opening every second closed locker he encounters, until all lockers are opened. What is the number of the last locker he opens?

Present the answer in LaTex format: \boxed{Your answer}
user