A paradox also known as the surprise examination paradox
or prediction paradox.

A prisoner is told that he will be hanged on some day between Monday and Friday, but that he will not know on which day the hanging will occur before it happens. He cannot be hanged on Friday, because if he were still alive on Thursday, he would know that the hanging will occur on Friday, but he has been told he will not know the day of his hanging in advance. He cannot be hanged Thursday for the same reason, and the same argument shows that he cannot be hanged on any other day. Nevertheless, the executioner unexpectedly arrives on some day other than Friday, surprising the prisoner.

This paradox is similar to that in Robert Louis Stevenson's "bottle imp paradox," in which you
are offered the opportunity to buy, for whatever price you wish, a bottle containing
a genie who will fulfill your every desire. The only catch is that the bottle must
thereafter be resold for a price smaller than what you paid for it, or you will be
condemned to live out the rest of your days in excruciating torment. Obviously, no
one would buy the bottle for 1¢ since he would have to give the bottle away,
but no one would accept the bottle knowing he would be unable to get rid of it. Similarly,
no one would buy it for 2¢, and so on. However, for some reasonably large amount,
it will always be possible to find a next buyer, so the bottle will be bought (Paulos
1995).

Chow, T. Y. "The Surprise Examination or Unexpected Hanging Paradox." Amer. Math. Monthly105, 41-51, 1998.Clark,
D. "How Expected is the Unexpected Hanging?" Math. Mag.67,
55-58, 1994.Erickson, G. W. and Fossa, J. A. Dictionary
of Paradox. Lanham, MD: University Press of America, pp. 158-159, 1998.Gardner,
M. "The Paradox of the Unexpected Hanging." Ch. 1 in The
Unexpected Hanging and Other Mathematical Diversions. Chicago, IL: Chicago
University Press, pp. 11-23, 1991.Margalit, A. and Bar-Hillel,
M. "Expecting the Unexpected." Philosophia13, 263-288, 1983.Pappas,
T. "The Paradox of the Unexpected Exam." The
Joy of Mathematics. San Carlos, CA: Wide World Publ./Tetra, p. 147,
1989.Paulos, J. A. A
Mathematician Reads the Newspaper. New York: BasicBooks, p. 97, 1995.Quine,
W. V. O. "On a So-Called Paradox." Mind62, 65-67,
1953.