cinelli wrote:A mathematical challenge.
What is the remainder when 2021 factorial is divided by 2017 squared? ...
A spoiler for that part, though it includes a reference to a mathematical theorem that I'm not going to try to prove here - look it up on Wikipedia and research the mathematics used there if you feel you need to know full details!
Taking out the common factor 2017, and using the expression x rmdr y for the positive remainder of x when divided by y:
(2021!) rmdr (2017^2) = 2017 * ((2016! * 2018 * 2019 * 2020 * 2021) rmdr 2017)
= (((2016!) rmdr 2017) * (2018 rmdr 2017) * (2019 rmdr 2017) * (2020 rmdr 2017) * (2021 rmdr 2017)) rmdr 2017
= (((2016!) rmdr 2017) * 1 * 2 * 3 * 4) rmdr 2017
= (24 * ((2016!) rmdr 2017)) rmdr 2017
2017 is prime, which allows me to use Wilson's theorem, which says that (p-1)! is congruent to -1 modulo p for any prime p (i.e. p divides the difference between (p-1)! and -1). That implies that it's also congruent to p-1 modulo p, so (2016!) rmdr 2017 = 2016, and so the answer is (24 * 2016) mod 2017 = 1993.
cinelli wrote:... And what is the connection between your answer and the Grand National?
And a spoiler for that part as well, though obtained by guessing and checking my guess is correct - my knowledge of the Grand National was almost non-existent (and only slightly better now!):
It seemed likely that there was something special about the 1993 Grand National, and looking up "1993 Grand National" on Wikipedia confirms that guess: 1993 was the year that the Grand National was declared void.
Gengulphus