Solve recursive maths problems