Learning Mathematical Rules with Large Language Models