Construct an array of first N natural numbers such that every adjacent pair is coprime | C ++ program to implement the above approach ; Function to construct an arrary with adjacent elements as co - prime numbers ; Iterate over the range [ 1 , N ] ; Print i ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void ConstArrayAdjacentCoprime ( int N ) { for ( int i = 1 ; i <= N ; i ++ ) { cout << i << " ▁ " ; } } int main ( ) { int N = 6 ; ConstArrayAdjacentCoprime ( N ) ; return 0 ; }