This trick consists of divining which of three objects three persons have each secretly taken, using a cue provided by the number of counters left on the table, picked up to a mathematical pattern. Its method is given in an Arabic manuscript Miftāh al-mu‘āmalāt attributed to al-Ṭabarī, c. 1075, p. 109, pt. IV, no. 17. This is noted by David Singmaster in his Sources in Recreational Mathematics: An Annotated Bibliography, 7.AO. Divination of a Permutation, online. Singmaster also lists examples in Leonardo Fibonacci's Liber Abaci, 1202, pp. 304-8; Nicolas Chuquet's Triparty en la science des nombres, 1484, p. 47 of the 1882 Rome edition; and numerous other sources. On Chuquet, see also Guillemin's An Illustrated History of White Magic, p. 93.