Number of digits in 2 raised to power n | Python3 program to find number of digits in 2 ^ n ; Function to find number of digits in 2 ^ n ; Driver code
import math NEW_LINE def countDigits ( n ) : NEW_LINE INDENT return int ( n * math . log10 ( 2 ) + 1 ) ; NEW_LINE DEDENT n = 5 ; NEW_LINE print ( countDigits ( n ) ) ; NEW_LINE