Improved education and living conditions have narrowed the gender gap in math but have made women much better at certain memory tasks, new research suggests.