The solution to S. Smale’s 18th problem