A memoization based optimized CPP program to find n - th SchrAderaHipparchus number
#include <bits/stdc++.h> NEW_LINE #define MAX  500 NEW_LINE using namespace std ; int nthSHN ( int n , int dp [ ] ) { if ( n == 1 n == 2 ) return dp [ n ] = 1 ; if ( dp [ n ] != -1 ) return dp [ n ] ; return dp [ n ] = ( ( 6 * n - 9 ) * nthSHN ( n - 1 , dp ) - ( n - 3 ) * nthSHN ( n - 2 , dp ) ) / n ; }