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 .
< ? php function number_of_digits ( $ n ) { $ i ; $ res ; $ sum = 0 ;