He gets all the students to line up in a long row, and gives them a number from 1 to 2000. Then, he asks those with an odd number to leave, as they are not lucky enough.

With those that remain, he orders them again from 1 to 1000. Those which have an odd number are told to leave, as they are not lucky enough.

The professor repeats this process again and again until there is only 1 student left in this row.

What is the initial number that was given to the student who remained?