Pair of integers ( a , b ) which satisfy the given equations | Function to count valid pairs ; Driver code
def pairCount ( n , m ) : NEW_LINE INDENT cnt = 0 ; NEW_LINE for b in range ( int ( pow ( m , 1 / 2 ) ) ) : NEW_LINE INDENT a = m - b * b ; NEW_LINE if ( a * a + b == n ) : NEW_LINE INDENT cnt += 1 ; NEW_LINE DEDENT DEDENT return cnt ; NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT n = 9 ; NEW_LINE m = 3 ; NEW_LINE print ( pairCount ( n , m ) ) ; NEW_LINE DEDENT