text: Loop to iterate from 1 to N and calculating number of octal numbers for every ' i ' th digit .
code: for i in range ( N + 1 ) : NEW_LINE INDENT sum += 7 * ( 8 ** ( i - 1 ) ) ; NEW_LINE DEDENT return int ( sum ) ; NEW_LINE