He was abducted by Hagrid when he turned 11 so that would place him maybe around the fifth or sixth grade.
I don’t know if canonically there are math classes at Hogwarts.
The thought came to while I was watching the anime Mashle. If you are into Harry Potter and One-Punch Man I’d recommend giving it a watch.
Someone mentioned this community below; I wanted to highlight it.
Small promotion for !harrypotter@literature.cafe
If you haven’t already, take a peek at Harry Potter and the Methods of Rationality. It’s fanfiction, but absolutely worth a read.
Oh man I totally forgot about that! Oh nice they have it in ebook and pdf formats now
Just a warning: this takes pretty much every bad FF trope you can think of and turns it to max. Awful reading.
To add, the podcast is phenomenal. Definitely worth listening to as well