Problem #WSP-5335

Problems Mathematical logic

Problem

The recertification of the Council of Sages takes place as follows: the king arranges them in a column one by one and puts on a cap of white or black colours for each. All the sages see the colours of all the caps of the sages standing in front, but they do not see the colour of their own and all those standing behind. Once a minute one of the wise men must shout one of the two colours. (each sage shouts out a colour once). After the end of this process the king executes every sage who shouts a colour different from the colour of his cap. On the eve of the recertification all one hundred members of the Council of Sages agreed and figured out how to minimize the number of those executed. How many of them are guaranteed to avoid execution?