Split first N natural numbers into two subsequences with non | Java program for the above approach ; Function to split 1 to N into two subsequences with non - coprime sums ; Driver code
class GFG { public static void printSubsequence ( int N ) { System . out . print ( " { ▁ " ) ; for ( int i = 1 ; i < N - 1 ; i ++ ) { System . out . print ( i + " , ▁ " ) ; } System . out . println ( N - 1 + " ▁ } " ) ; System . out . print ( " { ▁ " + N + " ▁ } " ) ; } public static void main ( String [ ] args ) { int N = 8 ; printSubsequence ( N ) ; } }