Learning Autonomous Code Integration for Math Language Models