MathDB
Magician's epicness

Source: Bulgaria EGMO TST 2016 Day 1 Problem 3

February 3, 2023
combinatoricsMagicianinductionlogic

Problem Statement

The eyes of a magician are blindfolded while a person AA from the audience arranges nn identical coins in a row, some are heads and the others are tails. The assistant of the magician asks AA to write an integer between 11 and nn inclusive and to show it to the audience. Having seen the number, the assistant chooses a coin and turns it to the other side (so if it was heads it becomes tails and vice versa) and does not touch anything else. Afterwards, the bandages are removed from the magician, he sees the sequence and guesses the written number by AA. For which nn is this possible?
[hide=Spoiler hint] The original formulation asks: a) Show that if nn is possible, so is 2n2n; b) Show that only powers of 22 are possible; I have omitted this from the above formulation, for the reader's interest.