Probability that an arbitrary positive divisor of 10 ^ X is an integral multiple of 10 ^ Y | Python3 program to find the probability of an arbitrary positive divisor of Xth power of 10 to be a multiple of Yth power of 10 ; Function to calculate and print the required probability ; Count of potential divisors of X - th power of 10 which are also multiples of Y - th power of 10 ; Count of divisors of X - th power of 10 ; Calculate GCD ; Print the reduced fraction probability ; Driver Code
from math import * NEW_LINE def prob ( x , y ) : NEW_LINE INDENT num = abs ( x - y + 1 ) * abs ( x - y + 1 ) NEW_LINE den = ( x + 1 ) * ( x + 1 ) NEW_LINE gcd1 = gcd ( num , den ) NEW_LINE print ( num // gcd1 , end = " " ) NEW_LINE print ( " / " , end = " " ) NEW_LINE print ( den // gcd1 ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT X = 2 NEW_LINE Y = 1 NEW_LINE prob ( X , Y ) NEW_LINE DEDENT