Twelve islanders sit evenly around a round table. Each is either a knight (always tells the truth) or a knave (always lies). Every one of them says: My two neighbours are of the same type as each other (both knights or both knaves). A visitor also learns, reliably, that at least one knave is at the table. How many knights are at the table?
Enter an integer
Show solution
Write xi=1 for a knight and 0 for a knave. Person i's statement is true iff xi−1=xi+1, and it is true iff i is a knight, so xi=1⊕xi−1⊕xi+1, i.e. xi−1+xi+xi+1≡1(mod2) for every i. Subtracting consecutive equations gives xi+2=xi−1, so the pattern repeats every 3 seats (consistent since 3∣12), and each block of three has an odd number of knights: either 3 (everyone a knight) or exactly 1. All knights is ruled out, so the pattern is knight, knave, knave repeated: check that a knight sees two knaves (true) and a knave sees a knight and a knave (false). That gives 12/3=4 knights.