def fermat_little_theorem(p):
 a = randint(1, (p - 1))
 return fast_exponentiation(a, (p - 1), p)

def fermat_little_theorem ( p ) : a = randint ( 1 , ( p - 1 ) ) return fast_exponentiation ( a , ( p - 1 ) , p )
returns 1 if p may be prime .