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

This applet requires Sun's Java VM 2 which your browser may perceive as a popup. Which it is not. If you want to see the applet work, visit Sun's website at, download and install Java VM and enjoy the applet.

What if applet does not run?


|Contact| |Front page| |Contents| |Algebra| |Store|

Copyright © 1996-2017 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

Related material

  • An Arithmetic Magic Trick
  • Bachet's Magic Trick
  • Hummer's Mind Reader
  • Magic in Square
  • Math Telepathy
  • Number Guessing Game. All by Computer
  • Barcode Magic
  • Arithmetic magic matrix
  • Calendar Magic: an Interactive Gizmo
  • Two Numbers Guessing Game
  • |Contact| |Front page| |Contents| |Algebra| |Store|

    Copyright © 1996-2017 Alexander Bogomolny


    Search by google: