Index of smallest triangular number with N digits | Function to return index of smallest triangular no n digits ; Driver code
function findIndex ( n ) { let x = Math . sqrt ( 2 * Math . pow ( 10 , ( n - 1 ) ) ) ; return Math . round ( x ) ; } let n = 3 ; document . write ( findIndex ( n ) ) ;