Index of smallest triangular number with N digits | Java implementation of the above approach ; Function to return index of smallest triangular no n digits ; Driver code
class GFG { static double findIndex ( int n ) { double x = Math . sqrt ( 2 * Math . pow ( 10 , ( n - 1 ) ) ) ; return Math . round ( x ) ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . print ( findIndex ( n ) ) ; } }