Base case
if Y == 0 : NEW_LINE INDENT return 1 NEW_LINE DEDENT p = power ( X , Y // 2 , Mod ) % Mod NEW_LINE p = ( p * p ) % Mod NEW_LINE if Y & 1 : NEW_LINE INDENT p = ( X * p ) % Mod NEW_LINE DEDENT return p NEW_LINE