Newman | C ++ program for n - th element of Newman - Conway Sequence ; Recursive Function to find the n - th element ; Driver Program
#include <bits/stdc++.h> NEW_LINE using namespace std ; int sequence ( int n ) { if ( n == 1 n == 2 ) return 1 ; else return sequence ( sequence ( n - 1 ) ) + sequence ( n - sequence ( n - 1 ) ) ; } int main ( ) { int n = 10 ; cout << sequence ( n ) ; return 0 ; }