Project Euler #123: Prime square remainders

  • + 1 comment

    Just note that if is even, the remainder is , otherwise, the remainder is .

    This is easy to see since

    Also remember to look for and small cases.