Function to find out frequency of numbers from 1 to N having their sum of digits from 1 to 162 and store them in array
static List < long > formArray ( long N ) { long [ , , ] dp = new long [ 20 , 2 , 166 ] ; for ( int i = 0 ; i < 20 ; i ++ ) { for ( int j = 0 ; j < 2 ; j ++ ) { for ( int k = 0 ; k < 166 ; k ++ ) { dp [ i , j , k ] = - 1 ; } } }