A script to find lucky student
There are 2019 students attending a reading activity. After the activity, the sponsor will choose one lucky student to send one book through an interesting game. At first, 2019 students stand in a line and number themselves by the pattern 1, 2, 1, 2. Students numbered 2 will stay and students numbered 1 leave. After first round, remaining students don't change their position and continue this numbering game. Following this rule, the last remaining student will be the lucky star to get the gift book. What is the position of this lucky student at the beginning?
Copy the script to https://www.online-python.com/ and run it. Just input the student number, you will get the positoin of lucky student.