Find remainder of exponent
rem = x % 6 NEW_LINE if ( ( sum == 3 or sum == 6 ) and x > 1 ) : NEW_LINE INDENT return 9 NEW_LINE DEDENT elif ( x == 1 ) : NEW_LINE INDENT return sum NEW_LINE DEDENT elif ( x == 0 ) : NEW_LINE INDENT return 1 NEW_LINE DEDENT elif ( rem == 0 ) : NEW_LINE INDENT return digSum ( math . pow ( sum , 6 ) ) NEW_LINE DEDENT else : NEW_LINE INDENT return digSum ( math . pow ( sum , rem ) ) NEW_LINE DEDENT