Number of digits in 2 raised to power n | Function to find number of digits in 2 ^ n ; Driver code
function countDigits ( n ) { return ( n * Math . log10 ( 2 ) + 1 ) ; } let n = 5 ; document . write ( Math . floor ( countDigits ( n ) ) ) ;