Find the Largest N digit perfect square number in Base B | Python3 implementation to 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
import math NEW_LINE def nDigitPerfectSquares ( n , b ) : NEW_LINE INDENT largest = pow ( math . ceil ( math . sqrt ( pow ( b , n ) ) ) - 1 , 2 ) NEW_LINE print ( largest ) NEW_LINE DEDENT N = 1 NEW_LINE B = 8 NEW_LINE nDigitPerfectSquares ( N , B ) NEW_LINE