human
What is a code to ugly Numbers and the other steps required given the following:
Ugly Numbers | This function divides a by greatest divisible power of b.
Function to check if a number is ugly or not.
Function to get the nth ugly number.
ugly number count.
Check for all integers untill ugly count becomes n.
Driver code"
Solution in Python:
assistant
#Here is code to ugly Numbers and the other steps required.
 def maxDivide ( a , b ) :
	while a % b == 0 :
		a = a / b
	return a
def isUgly ( no ) :
	no = maxDivide ( no , 2 )
	no = maxDivide ( no , 3 )
	no = maxDivide ( no , 5 )
	return 1 if no == 1 else 0
def getNthUglyNo ( n ) :
	i = 1
	count = 1
	while n > count :
		i += 1
		if isUgly ( i ) :
			count += 1
	return i
no = getNthUglyNo ( 150 )
print ( "150th ▁ ugly ▁ no . ▁ is ▁ " , no )