Compositional Processing Emerges in Neural Networks Solving Math Problems