Problem Description
You are given two positive numbers A and B. You need to find the maximum valued integer X such that:
X divides A i.e. A % X = 0
X and B are co-prime i.e. gcd(X, B) = 1
For example,
A = 30
B = 12
We return
X = 5
Problem Constraints
1<=A,B<=1e9
Input Format
First argument is A.
Second argument is B.
Output Format
Find the maximum valued integer X which satisfies the above properties.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified.
Still have a question? Checkout Sample Codes for more details.