Bill Kalush has found of version of this ancient mathematical card effect in Nicolas Chuquet's Triparty, written in 1484, but never published. Only one extant copy is known. The trick is not done with cards, but with coins or other objects, arranged in a circle, but the principle is there.