Function to check if the number is divisible by 53 or not
def isDivisible ( s ) : NEW_LINE INDENT flag = 0 NEW_LINE while ( len ( s ) > 4 ) : NEW_LINE INDENT l = len ( s ) - 1 NEW_LINE x = ( ord ( s [ l ] ) - ord ( '0' ) ) * 37 NEW_LINE s = s [ : : - 1 ] NEW_LINE s = s . replace ( '0' , ' ' , 1 ) NEW_LINE i = 0 NEW_LINE carry = 0 NEW_LINE while ( x ) : NEW_LINE INDENT d = ( ( ord ( s [ i ] ) - ord ( '0' ) ) - ( x % 10 ) - carry ) NEW_LINE if ( d < 0 ) : NEW_LINE INDENT d += 10 NEW_LINE carry = 1 NEW_LINE DEDENT else : NEW_LINE INDENT carry = 0 NEW_LINE DEDENT s = s . replace ( s [ i ] , chr ( d + ord ( '0' ) ) , 1 ) NEW_LINE x //= 10 NEW_LINE i += 1 NEW_LINE DEDENT while ( carry and i < l ) : NEW_LINE INDENT d = ( ord ( s [ i ] ) - ord ( '0' ) ) - carry NEW_LINE if ( d < 0 ) : NEW_LINE INDENT d += 10 NEW_LINE carry = 1 NEW_LINE DEDENT else : NEW_LINE INDENT carry = 0 NEW_LINE DEDENT s = s . replace ( s [ i ] , chr ( d + ord ( '0' ) ) , 1 ) NEW_LINE i += 1 NEW_LINE DEDENT s = s [ : : - 1 ] NEW_LINE DEDENT num = 0 NEW_LINE for i in range ( len ( s ) ) : NEW_LINE INDENT num = num * 10 + ( ord ( s [ i ] ) - ord ( '0' ) ) NEW_LINE DEDENT if ( num % 53 == 0 ) : NEW_LINE INDENT return True NEW_LINE DEDENT else : NEW_LINE INDENT return False NEW_LINE DEDENT DEDENT