Check if a number has an odd count of odd divisors and even count of even divisors | Python3 implementation of the above approach ; Function to check if the number is a perfect square ; Find floating povalue of square root of x . ; If square root is an integer ; Function to check if count of even divisors is even and count of odd divisors is odd ; Driver code
import math NEW_LINE def isPerfectSquare ( x ) : NEW_LINE INDENT sr = pow ( x , 1 / 2 ) ; NEW_LINE return ( ( sr - math . floor ( sr ) ) == 0 ) ; NEW_LINE DEDENT def checkFactors ( x ) : NEW_LINE INDENT if ( isPerfectSquare ( x ) ) : NEW_LINE INDENT print ( " Yes " ) ; NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) ; NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT N = 36 ; NEW_LINE checkFactors ( N ) ; NEW_LINE DEDENT