human
What is a code to power of a prime number ‘ r ’ in n ! and the other steps required given the following:
Power of a prime number ‘ r ’ in n ! | Function to return power of a no . ' r ' in factorial of n.
Keep dividing n by powers of ' r ' and update count.
Driver Code"
Solution in Python:
assistant
#Here is code to power of a prime number ‘ r ’ in n ! and the other steps required.
 def power ( n , r ) :
	count = 0 ; i = r
	while ( ( n / i ) >= 1 ) :
		count += n / i
		i = i * r
	return int ( count )
n = 6 ; r = 3
print ( power ( n , r ) )