Mathematician cracks 150-year-old chess problem