MathDB
hard combinatorics

Source: II Caucasus Mathematical Olympiad

March 20, 2018
combinatorics

Problem Statement

Given a table in a form of the regular 10001000-gon with sidelength 11. A Beetle initially is in one of its vertices. All 10001000 vertices are numbered in some order by numbers 11, 22, \ldots, 10001000 so that initially the Beetle is in the vertex 11. The Beetle can move only along the edges of 10001000-gon and only clockwise. He starts to move from vertex 11 and he is moving without stops until he reaches vertex 22 where he has a stop. Then he continues his journey clockwise from vertex 22 until he reaches the vertex 33 where he has a stop, and so on. The Beetle finishes his journey at vertex 10001000. Find the number of ways to enumerate all vertices so that the total length of the Beetle's journey is equal to 20172017.