Count of Ordered Pairs ( X , Y ) satisfying the Equation 1 / X + 1 / Y = 1 / N | Function to find number of ordered positive integer pairs ( x , y ) such that they satisfy the equation ; Initialize answer variable ; Iterate over all possible values of y ; For valid x and y , ( n * n ) % ( y - n ) has to be 0 ; Increment count of ordered pairs ; Prvar the answer ; Driver Code ; Function call
function solve ( n ) { var ans = 0 ; for ( y = n + 1 ; y <= n * n + n ; y ++ ) { if ( ( n * n ) % ( y - n ) == 0 ) { ans += 1 ; } } document . write ( ans ) ; } var n = 5 ; solve ( n ) ;