Smarter way to solve math problems