In the Multiplicative Hall of Prime City, the Royal Mathematician demonstrates a key property of Euler's totient function: it is multiplicative. When gcd(a, b) = 1, ¤å(a*b) = ¤å(a) * ¤å(b). This property is fundamental to computing ¤å for large numbers from their prime factorization. "The totient function is multiplicative but not completely multiplicative," the Mathematician explains. "It only splits over coprime factors. Use this to compute ¤å for products of coprime numbers efficiently." Given two coprime integers a and b, compute ¤å(a*b). You may compute ¤å(a) and ¤å(b) separately and multiply them. Constraints: 1 <= a, b <= 10^12, gcd(a, b) = 1 Input: 3 5 Output: 8 Input: 4 9 Output: 24
Constraints:
1 <= a, b <= 10^12, gcd(a, b) = 1
Tags:
