Problem

Source: 2017 Peru Ibero TST P3

Tags: combinatorics



We have a table in the form of a regular polygon with $1000$ sides, where each side has length $1$. At one of the vertices is a beetle (consider this vertex to be fixed). The $1000$ vertices must be numbered, in some order, using the numbers $1, 2,\ldots ,1000$ such that the beetle is at vertex $1$. The beetle can only move along the edge of the table and always moves clockwise. The beetle moves from vertex $1$ to vertex $2$ and stops there. then it moves from vertex $2$ to vertex $3$, and stops there. So on, until the beetle ends its journey at vertex $1000$. Find the number of ways the numbers can be assigned to the vertices so that the total length of the beetle's journey is $2017$.