A stratagem that dates back two millennia leads to a math puzzle that took 30 years to solve