What's funny is I was that guy (not literally the same guy, but did similar things) as GP describes who could type in a program implementing the math lesson in the time it took the teacher to describe it.
And. I. Struggled. So. Much. with math classes.
Could never get homework done because I couldn't focus due to undiagnosed (and thus unmedicated) ADHD. On tests it'd take me the whole hour to do three problems out of twenty because I had to re-derive every equation and lemma from first principles before I convinced myself I was doing it right. And then (probably again due to the undiagnosed ADHD) I'd transpose symbols while working the problem or make other working-memory errors.
The best math class experience I had (later in life) was with a professor at a community college who was a military veteran (mentioned because it influenced his attitude toward teaching). He said, "I'm going to spend hardly any time explaining things; we're just going to work the problems." And that's what we did; we just worked problems.
You'd think I'd be bored with that, but it was the opposite. As I think about it now to try to explain why, I realize that other math classes I'd been in the expectation was lecture was for explaining the concepts, homework was for self-directed working the problems, and tests were for demonstrating that. But if you're bright and have ADHD you're quickly bored with the explanation and completely UNable to self-direct working the problems. So the class time was wasted and homework sessions were hell. So this professor using class time to work the problems was just what I needed.