The stunt of divining which of three objects three persons have secreted on their person by the number of counters left on the table, picked up to a mathematical pattern, is found in Nicolas Chuquet's Triparty en la science des nombres in 1484. See Guillemin's An Illustrated History of White Magic, p. 93.