Skip to content
Prev Previous commit
Next Next commit
Added type annotation.
  • Loading branch information
quant12345 committed Oct 5, 2023
commit d190bbd9bf71eac86d179eaaf295f8f14a86fada
4 changes: 3 additions & 1 deletion maths/fermat_little_theorem.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
# Here we assume that p is a prime number, b divides a, and p doesn't divide b
# Wikipedia reference: https://en.wikipedia.org/wiki/Fermat%27s_little_theorem

from typing import Union

def binary_exponentiation(a, n, mod):

def binary_exponentiation(a: int, n: Union[int, float], mod: int) -> int:
if n == 0:
return 1

Expand Down