SchrÃ ¶ derâ €“ Hipparchus number | A memoization based optimized C # program to find n - th Schroder - Hipparchus number ; Driver code
using System ; class GFG { static int MAX = 500 ; static 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 ; } public static void Main ( ) { int n = 6 ; int [ ] dp = new int [ MAX ] ; for ( int i = 0 ; i < dp . Length ; i ++ ) dp [ i ] = - 1 ; Console . Write ( nthSHN ( n , dp ) ) ; } }