At around 14:00 in the first episode of Puella Magi Madoka Magica, there are 3 math questions in the blackboard. (The following pictures are for the convenience for reference.)
Question: Let p be a prime number, n an arbitrary fixed natural number, prove that (1+n)^p - n^p - 1 can be divided by p.
Question: An integer divided by 14 will have an integer quotient with a remainder between 0 and 13. a is an integer with a remainder of 6 when divided by 14, b is an integer with a remainder of 1 when divided by 14. The quadratic equation x^2-2ax+b=0 can be solved for an integer solution. Find the remainder when this integer solution is divided by 14.
Question: Find all the integer solutions (a,b) for the equation a^3+a^2-1=(a-1)b.
In the anime, the characters are just middle school students, but the questions are not in a normal middle school level. The solution of the first question above uses the formula of binomial expansion, which, according to the middle school math syllabus in Japan (for reference, the school years in Japan), is not required for a middle schooler. The formula of binomial expansion is in fact in the syllabus of the high school. The other two questions are barely in the syllabus of middle school math, yet their solutions are quite tricky, which no one would expect from a middle schooler.
I wonder if the MCs are attending an elite school, which expects more from its students. Are there elite schools or private schools in Japan that teach advanced knowledge for their students' age, say high school or even university math? (It's said that the USSR used to have this kind of schools for talented students.)