Group all co | Function to group the mutually co - prime numbers into one group ; Loop for the numbers less than the 4 ; Integers 1 , 2 and 3 can be grouped into one group ; Consecutive even and odd numbers ; Driver Code ; Function Call
function mutually_coprime ( n ) { if ( n <= 3 ) { for ( let j = 1 ; j < n + 1 ; j ++ ) document . write ( j + " " + " " ) ; document . write ( " " ) ; } else { document . write ( " " + " " ) ; for ( let j = 4 ; j < n ; j += 2 ) { document . write ( j + " " + ( j + 1 ) + " " ) ; if ( n % 2 == 0 ) document . write ( n + " " ) ; } } } let n = 9 ; mutually_coprime ( n ) ;