Possible values of Q such that , for any value of R , their product is equal to X times their sum | Function to find all possible values of Q ; Vector initialization to store all numbers satisfying the given condition ; Iterate for all the values of X ; Check if condition satisfied then push the number ; Possible value of Q ; Print all the numbers ; Driver code
function values_of_Q ( X ) { let val_Q = [ ] ; for ( let i = 1 ; i <= X ; i ++ ) { if ( ( ( ( X + i ) * X ) ) % i == 0 ) { val_Q . push ( X + i ) ; } } document . write ( val_Q . length + " " ) ; for ( let i = 0 ; i < val_Q . length ; i ++ ) { document . write ( val_Q [ i ] + " " ) ; } } let X = 3 ; values_of_Q ( X ) ;