This problem was proposed by Max Black in 1946, and Gardner wrote about it in his February 1957 Scientific American column. It's in Chapter 3 of the first Scientific American spin-off book, now available in revised form as Hexaflexagons, probability paradoxes, and the Tower of Hanoi and also on page 2 of My best mathematical and logic puzzles.
Gardner, M. and Mathematical Association of America. (2008). Hexaflexagons, probability paradoxes, and the Tower of Hanoi : Martin Gardner's first book of mathematical puzzles and games. Cambridge ; New York, Cambridge University Press. 781b155fdc