Cut the knot: learn to enjoy mathematics
A math books store at a unique math study site. Learn to enjoy mathematics.
Terms of use
Privacy Policy

More Mathematics
CTK Exchange

Games to Relax
Guest book
Recommend this site

Sites for teachers
Sites for parents

Manifesto: what CTK is about Buying a book is a commitment to learning Things you can find on CTK Email to Cut The Knot Recommend this page

Gergonne's Magic Trick

The numbers from 1 through 27 are displayed below in three rows of nine numbers each. Select one of those numbers and reply truthfully to three computer queries. Keep your eyes open. Computer will reveal your number


Copyright © 1996-2008 Alexander Bogomolny











Gergonne's Magic Trick

To understand how the applet works you should first acquaint yourself with a simple card trick.

Instead of the playing cards, computer displays 27 numbers. Other than that, the procedure is very much the same, but with one exception. Since you are only asked to select a row, the order of numbers in that row is of no consequence. However, for computer it is a fairly simple task to reshuffle numbers in every row. This makes the trick to appear a little more complicated than it really is.

[Rouse Ball, p. 328-329] mentions that in 1813-1814 J. D. Gergonne proved a generalization that dealt with NN cards arranged in N rows of NN-1 cards each. It is always possible to combine rows in such a manner that after N replies the selected card will appear in any desired spot, not necessarily in the middle of the mid row.


  1. W. W. Rouse Ball, H. S. M. Coxeter, Mathematical Recreations and Essays, Dover, 1987

Copyright © 1996-2008 Alexander Bogomolny