Find a number containing N | C ++ implementation of the approach ; Function to compute number using our deduced formula ; Initialize num to n - 1 ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; #define ll  long long int NEW_LINE ll findNumber ( int n ) { ll num = n - 1 ; num = 2 * ( ll ) pow ( 4 , num ) ; num = floor ( num / 3.0 ) ; return num ; } int main ( ) { int n = 5 ; cout << findNumber ( n ) ; return 0 ; }