Find the Largest N digit perfect square number in Base B | Function to find the largest N digit number ; Largest n - digit perfect square ; Print the result ; Driver Code
function nDigitPerfectSquares ( n , b ) { var largest = Math . pow ( Math . ceil ( Math . sqrt ( Math . pow ( b , n ) ) ) - 1 , 2 ) ; document . write ( largest ) ; } var N = 1 , B = 8 ; nDigitPerfectSquares ( N , B ) ;