The logician with 1 hat must go first for the game to end.
Reasoning:
- Each logician before the one with 1 hat will answer "I don't know", demonstrating that he sees either 1 or 2 logicians with 1 hat among those who haven't had a turn.
- When the logician with 1 hat states that he has 1 hat, that demonstrates that he sees no logicians with 1 hat among those who haven't had a turn yet. All logicians who haven't had a turn yet thus know that they have 2 hats. Of the logicians who said "I don't know", at most one of them has 1 hat (to their knowledge).
- The logician who went first gets his second turn, and again says "I don't know", indicating that he sees no other 1-hat logicians among those still undecided. They all know that they have 2 hats (Exception: if the logician with 1 hat was third, the second logician still doesn't know).
- The logician who went first is now stuck, unless he was the logician with 1 hat to begin with.
I've worked out the sequence of moves the logicians will make in each possible arrangement, with each possible total number of hats (7, 8, 9).
Legend:
- 1: "1 hat"
- 2: "2 hats"
- ?: "I don't know"
- -: Passed turn (already said hat count)
These sequences complete:
- 12222: 12222*
- 21112: 21112*
- 21121: 21121*
- 22111: 22111*
- 12112: ?21121*
- 12121: ?21211*
- 11212: ??21211*
- 11221: ??22111*
- 22112: ???12221*
- 21212: ???12?212*
- 21221: ????12122*
- 22121: ????12212*
These sequences do not complete:
- 11222: ?1222?----
- 21222: ?1222?----
- 12122: ??122??---
- 22122: ??122??---
- 11122: ??122??---
- 21122: ??122??---
- 12212: ???12?22--?----
- 22212: ???12?22--?----
- 22211: ?22?1?--11?----
- 12211: ?22?1?--11?----
- 12221: ????1?222-?----
- 22221: ????1?222-?----