I once came across the following riddle: (assume $N$ to be extremely large)
There are $N$ perfect logicians arranged in a vertical row. They are allowed to strategize before the game, during the game they are barred from communicating. In the game, the lights are switched off, and a single hat, either red or blue, is placed on the heads of each of the logicians. The lights are turned on; each logician can see the hat colours of all the people in front of him, he can't see the colour of his own hat, or the people behind him. Start with the person at the back, each logician has to call out a colour (heard by all). If his own hat is of that colour, he is spared, otherwise, silently killed. The same is done by the next person, and so on, right till the first person. How many logicians can you guarantee to save, irrespective of the initial colours or any probability?
The answer was simple. The first logician would sacrifice his life. He would call out red if there are an even number of red hats in front of him, and black if there an odd number of red hats. After him, each logician can correctly tell the colour of his own hat.
I decided to give the question a twist. Suppose there is a blind man among the logicians. His life is worth as much as anyone else, and he is placed randomly in the queue. How many logicians can you guarantee to save?
The same approach wouldn't work because, if the blind man gave the wrong colour, not only him, but all the people in front of him will give the wrong colour as they depend on his information also.
After a lot of thinking, I finally came up with this solution.
Find the smallest $n$ such that $3(n+1)+2^n \geq N$. The first $3(n+1)$ people (from the back) will be the ones sacrificing their lives (Group A), and the rest ($2^n$) will try to figure out their own hat colours (Group B). Starting with the back of Group B, assign each logician an ($n+1$)-digit binary number, starting with a string of zeroes, and adding $1$ to get the next logician's ID. Note that the first digit will always be a $0$.The first Group is divided into $n+1$ subgroups of $3$ logicians each. Each subgroup is assigned a normal decimal number $1,2,3,\cdots$ and so on (again starting from the back). Let the subgroup number of a logician be $k$
When the game starts, each Group A logician will look at all the people in Group B, whose $k^{th}$ binary digit is $1$. Of these people, if there are an even number of red hats, he will say red, otherwise he will say blue. The other $2$ logicians in his subgroup will give exactly the same information as the first one. This is necessary to confirm that he is saying the truth, if there is a discrepancy among the $3$ answers, the information given by $2$ is correct, and the third one is the blind one. The same is done by everyone in Group A.
The people of Group B only try to figure out their own hat colours. Each logician has $n+1$ ways of figuring out his own hat colour. If all of the given data doesn't lead to the same answer, he knows that the blind man is behind him and has already called out a lie. He can then use the first logician's info (first in Group A and the queue itself) to figure out his own colour, since the blind man has for sure been counted by that person.
Is my approach correct and is there a faster one? I hope my question is clear enough.
Note: The blind man knows where is placed, but nobody else knows his position.