MathDB
Unlimited candy in PAGMO

Source: Pan-American Girls' Mathematical Olympiad 2021, P5

October 6, 2021
combinatoricsPAGMO

Problem Statement

Celeste has an unlimited amount of each type of nn types of candy, numerated type 1, type 2, ... type n. Initially she takes m>0m>0 candy pieces and places them in a row on a table. Then, she chooses one of the following operations (if available) and executes it:
1.1. She eats a candy of type kk, and in its position in the row she places one candy type k1k-1 followed by one candy type k+1k+1 (we consider type n+1n+1 to be type 1, and type 0 to be type nn).
2.2. She chooses two consecutive candies which are the same type, and eats them.
Find all positive integers nn for which Celeste can leave the table empty for any value of mm and any configuration of candies on the table.
<spanclass=latexitalic>ProposedbyFedericoBachandSantiagoRodriguez,Colombia</span><span class='latex-italic'>Proposed by Federico Bach and Santiago Rodriguez, Colombia</span>