human
Perfect Digital Invariants number | Function to find the sum of divisors.
Function to check whether the given number is Perfect Digital Invariant number or not.
For each digit in temp.
If satisfies Perfect Digital Invariant condition.
If sum exceeds n , then not possible.
Given Number N.
Function Call"
How can the above be solved in Python?
assistant
#Here is code to perfect Digital Invariants number and the other steps required.
 def power ( x , y ) :
	if ( y == 0 ) :
		return 1
	if ( y % 2 == 0 ) :
		return ( power ( x , y // 2 ) * power ( x , y // 2 ) )
	return ( x * power ( x , y // 2 ) * power ( x , y // 2 ) )
def isPerfectDigitalInvariant ( x ) :
	fixed_power = 0
	while True :
		fixed_power += 1
		temp = x
		summ = 0
		while ( temp ) :
			r = temp % 10
			summ = summ + power ( r , fixed_power )
			temp = temp // 10
		if ( summ == x ) :
			return ( True )
		if ( summ > x ) :
			return ( False )
N = 4150
if ( isPerfectDigitalInvariant ( N ) ) :
	print ( " Yes " )
else :
	print ( " No " )