human
Count all possible values of K less than Y such that GCD ( X , Y ) = GCD ( X + K , Y ) | Function to find the gcd of a and b.
Function to find the number of Ks.
Find gcd.
Calculating value of totient function for n.
Driver Code.
Given X and Y"
How can the above be solved in Python?

Write me a code to count all possible values of K less than Y such that GCD ( X , Y ) = GCD ( X + K , Y ) and the other steps required?
assistant
#Here is code to count all possible values of K less than Y such that GCD ( X , Y ) = GCD ( X + K , Y ) and the other steps required.
 def gcd ( a , b ) :
	if ( b == 0 ) :
		return a
	return gcd ( b , a % b )
def calculateK ( x , y ) :
	g = gcd ( x , y )
	n = y // g
	res = n
	i = 2
	while i * i <= n :
		if ( n % i == 0 ) :
			res -= ( res // i )
			while ( n % i == 0 ) :
				n //= i
		i += 1
	if ( n != 1 ) :
		res -= ( res // n )
	return res
if __name__ == " _ _ main _ _ " :
	x = 3
	y = 15
	print ( calculateK ( x , y ) )