Bachet's Magic Trick
Let N be an integer. This is the lone number at the bottom of the applet below. It can be modified by clicking on it. Currently it is 4. For practical reasons, it can change between 3 and 6, inclusive.
The integers from 1 through N·(N+1) are split into pairs. Select one pair (not just two integers but a pair among the pairs of integers the applet displays). Remember this pair, think hard of it with complete concentration, click the Proceed button. The same numbers will now be arranged in a N×(N+1) array. By just pointing to the two rows in which your selected numbers are located (if the numbers are in the same row, select it twice) you give your computer enough information to guess your numbers. Try it!
What if applet does not run? 
Contact Front page Contents Algebra
Copyright © 19962018 Alexander Bogomolny
Bachet's Magic Trick
The number of distinct pairs in which N objects may be combined is N·(N+1)/2. For example, if
Two sets of such pairs could be arranged in an N×(N+1) array in a peculiar manner. For example, for
 or 

where in the left half of the table I reversed the order of numbers in a pair. It is now clear that for a pair on the left, the first number points to the row, while the second to the column, in which the pair is located. Additionally, the second number points to the row in which the companion pair (i.e., the one with the original order of numbers) could be found. (Incidentally, its column number is one more than the row number of the left pair.) This means that the location of the latter is uniquely determined by the row numbers of the two pairs as is the location of the original pair.
Let's now label the 20 pairs with 20 numbers. If the left pair
To see how the association works, check the "Straight list" and uncheck the "Randomize" button in the applet below.
What if applet does not run? 
"Straight list" assigns the labels in a straightforward manner, such that the ordering of the pairs in the array becomes obvious. Otherwise, they are labeled in a random manner.
The "Randomize" button confounds the simplicity of the situation. Since all that is important is the rows of the two numbers, they may be located anywhere in the rows. When the randomize button is checked, the number are randomly permuted in every row just before being displayed in the array and, in addition, the numbers in a pair may occasionally swap rows.
[Rouse Ball, p. 326328] refers the problem and the particular arrangement of pairs of objects to the classical Problèmes plaisans et délectables by a pioneer of recreational mathematics Claude Gaspar Bachet, sieur de Méziriac (the 1^{st} edition published in 1612, the 2^{nd} in 1624.)
References
 W. W. Rouse Ball, H. S. M. Coxeter, Mathematical Recreations and Essays, Dover, 1987
Contact Front page Contents Algebra
Copyright © 19962018 Alexander Bogomolny
71868957