Newmanâ €“ Shanksâ €“ Williams prime | CPP Program to find NewmanaShanksaWilliams prime ; return nth NewmanaShanksaWilliams prime ; Base case ; Recursive step ; Driven Program
#include <bits/stdc++.h> NEW_LINE using namespace std ; int nswp ( int n ) { if ( n == 0 n == 1 ) return 1 ; return 2 * nswp ( n - 1 ) + nswp ( n - 2 ) ; } int main ( ) { int n = 3 ; cout << nswp ( n ) << endl ; return 0 ; }