Unexpected Hanging Paradox

The unexpected Hanging Paradox is a famous paradoxical problem about a prisoner who is being sentenced to death by a judge.

Description
A judge tells a condemned prisoner that this hanging will occur one day of the week, during the week that was to follow, at noon on the dote. He will not know what day of this week the hanging will occur, and it will be a surprise to the prisoner when the executioner knocks at his door at noon.

The prisoner returns to his cell and mulls the judge's words over to himself. He concludes that the surprise hanging cannot occur on Sunday, as if he wasn't hanged at noon on Saturday, the hanging on Sunday would not be a surprise. He then reasons that the hanging can therefore not occur on Saturday either; with Friday eliminated, should the hanging not occur on Friday, the hanging on Saturday would not be a surprise. This reasoning would then also conclude that the hanging cannot occur on Friday, Thursday, Wednesday, Tuesday, and Monday. Using this logic, he is confident and joyful that the hanging cannot occur on any day.

Come Wednesday, the following week. At noon, on the dote, the executioner knocks on the prisoner's cell door. Just s the judge had promised, this was a complete surprise to the prisoner.