Efficient function to calculate number of digits in the nth number constructed by using 6 , 1 , 4 and 9 as digits in the ascending order .
static int number_of_digits ( int n ) { int i ; int res ; int sum = 0 ;