Group all co | C ++ implementation to group mutually coprime numbers into one group with minimum group possible ; 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
#include <bits/stdc++.h> NEW_LINE using namespace std ; void mutually_coprime ( int n ) { if ( n <= 3 ) { for ( int j = 1 ; j <= n ; j ++ ) { cout << j << " ▁ " ; } cout << " STRNEWLINE " ; } else { cout << "1 ▁ 2 ▁ 3 STRNEWLINE " ; for ( int j = 4 ; j < n ; j += 2 ) { cout << j << " ▁ " << j + 1 << " STRNEWLINE " ; } if ( n % 2 == 0 ) cout << n << " STRNEWLINE " ; } } int main ( ) { int n = 9 ; mutually_coprime ( n ) ; }