Split N natural numbers into two sets having GCD of their sums greater than 1 | Function to create and print the two sets ; No such split possible for N <= 2 ; Print the first set consisting of even elements ; Print the second set consisting of odd ones ; Driver Code
function createSets ( N ) { if ( N <= 2 ) { document . write ( " " ) ; return ; } for ( let i = 2 ; i <= N ; i += 2 ) document . write ( i + " " ) ; document . write ( " " ) ; for ( let i = 1 ; i <= N ; i += 2 ) { document . write ( i + " " ) ; } } let N = 6 ; createSets ( N ) ;