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
def createSets ( N ) : NEW_LINE INDENT if ( N <= 2 ) : NEW_LINE INDENT print ( " - 1" ) ; NEW_LINE return ; NEW_LINE DEDENT for i in range ( 2 , N + 1 , 2 ) : NEW_LINE INDENT print ( i , end = " ▁ " ) ; NEW_LINE DEDENT print ( " " ) ; NEW_LINE for i in range ( 1 , N + 1 , 2 ) : NEW_LINE INDENT print ( i , end = " ▁ " ) ; NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT N = 6 ; NEW_LINE createSets ( N ) ; NEW_LINE DEDENT