Lorenza is on a track shaped like a regular polygon with 2007 sides, whose vertices are numbered from 1 to 2007 counterclockwise. Lorenza, starting from vertex 6, each time jumps over 4 vertices and lands on the fifth one ahead (for example, from 20 she jumps to 25), but jumps back 2 vertices when she lands on a vertex identified by a power of 2 (for example, after a possible jump from 27 to 32, she must jump back to 30). After how many jumps will Lorenza have passed vertex 1 for the first time?
Solution
Solution:
The answer is 405. Lorenza starts from vertex 6; already after 2 jumps she arrives at vertex , so she goes back to 14. At this point Lorenza will jump alternately onto an odd vertex (which cannot be a power of 2) and onto an even one; in particular, between one even vertex and the next she will need two jumps, corresponding to an increase of 10. Therefore the next power of 2 must end with the digit 4 like 14; it will thus be 64 and Lorenza will need 10 jumps to reach it. Starting now from 62, the smallest power of two greater than 62 and ending in the digit 2 is 512, and to reach it Lorenza will have to make jumps. From 510, Lorenza will no longer encounter any obstacles. Indeed, no larger power of 2 ends in 0 (like 510); Lorenza will then need 300 jumps to arrive at vertex 2010, that is vertex 3, and thus to pass vertex 1 for the first time. So in total Lorenza will have jumped times forward and 3 times backward, for a total of 405 jumps.