This is a tricky one, since there's a combination of two things:
The student is probably genuinely interested in the math and wants to grapple with the material.
The student is disrupting the classroom, and interrupting the lesson for other students.
On the one hand, you want to foster the student's interest and enjoyment of mathematics. On the other, ...