I have to write a program to calculate a**b % c where b and c are both very large numbers. If I just use a**b % c, it's really slow. Then I found that the built-in function pow() can do this really fast by calling pow(a, b, c).
 I'm curious to know how does Python implement this? Or where could I find the source code file that implement this function?
Python uses C math libraries for general cases and its own logic for some of its concepts (such as infinity).
How did Python implement the built-in function pow()?