I think it’s referencing Clever Hans, a horse who allegedly could do arithmetic and would respond to questions by tapping his hoof (Clever Hans famously could not actually do math - he had just learned to tap his foot until his trainer looked happy with the number of taps).
I had heard of Clever Hans before, but never knew the trainer himself wasn't actually aware he was giving cues to the house. The horse was actually really smart, just not in the way people imagined.
It's referencing an old trick some charlatans would do where they would train a horse to stomp its hoof in order to appear like it can do arithmetic. So like the con-man would ask the horse "what's 3+2?" And the horse would stomp its foot 5 times.