Smallest power of 2 consisting of N digits | Python3 program of the above approach ; Function to return smallest power of 2 with N digits ; Driver Code
from math import log2 , ceil NEW_LINE def smallestNum ( n ) : NEW_LINE INDENT power = log2 ( 10 ) NEW_LINE print ( power ) ; NEW_LINE return ceil ( ( n - 1 ) * power ) NEW_LINE DEDENT n = 4 NEW_LINE print ( smallestNum ( n ) ) NEW_LINE