human
Count numbers from range whose prime factors are only 2 and 3 | Function to count the number within a range whose prime factors are only 2 and 3.
Start with 2 so that 1 doesn 't get counted.
While num is divisible by 2 , divide it by 2.
While num is divisible by 3 , divide it by 3.
If num got reduced to 1 then it has only 2 and 3 as prime factors.
Driver code"
How can the above be solved in Python?
 Write me a code to count numbers from range whose prime factors are only 2 and 3 and the other steps required?
assistant
#Here is code to count numbers from range whose prime factors are only 2 and 3 and the other steps required.
 def findTwoThreePrime ( l , r ) :
	if ( l == 1 ) :
		l += 1
	count = 0
	for i in range ( l , r + 1 ) :
		num = i
		while ( num % 2 == 0 ) :
			num //= 2 ;
		while ( num % 3 == 0 ) :
			num //= 3
		if ( num == 1 ) :
			count += 1
	return count
if __name__ == " _ _ main _ _ " :
	l = 1
	r = 10
	print ( findTwoThreePrime ( l , r ) )