hard combinatorics
Source: II Caucasus Mathematical Olympiad
March 20, 2018
combinatorics
Problem Statement
Given a table in a form of the regular -gon with sidelength . A Beetle initially is in one of its vertices. All vertices are numbered in some order by numbers , , , so that initially the Beetle is in the vertex . The Beetle can move only along the edges of -gon and only clockwise. He starts to move from vertex and he is moving without stops until he reaches vertex where he has a stop. Then he continues his journey clockwise from vertex until he reaches the vertex where he has a stop, and so on. The Beetle finishes his journey at vertex . Find the number of ways to enumerate all vertices so that the total length of the Beetle's journey is equal to .