Partition first N natural number into two sets such that their sum is not coprime | Function to find the required sets ; Impossible case ; Sum of first n - 1 natural numbers ; Driver code
function find_set ( n ) { if ( n <= 2 ) { document . write ( " " ) ; return ; } let sum1 = parseInt ( ( n * ( n - 1 ) ) / 2 , 10 ) ; let sum2 = n ; document . write ( sum1 + " " + sum2 + " " ) ; } let n = 8 ; find_set ( n ) ;