Index of smallest triangular number with N digits | Python3 implementation of the above approach ; Function to return index of smallest triangular no n digits ; Driver Code
import math NEW_LINE def findIndex ( n ) : NEW_LINE INDENT x = math . sqrt ( 2 * math . pow ( 10 , ( n - 1 ) ) ) ; NEW_LINE return round ( x ) ; NEW_LINE DEDENT n = 3 ; NEW_LINE print ( findIndex ( n ) ) ; NEW_LINE