logo AlgoBeat OnlineJudge
登录 注册

#212673. [ICPC 2025 NAC] A Totient Quotient

内存限制:2048 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

For a positive integer , Euler's totient function is defined as the number of positive integers less than or equal to and relatively prime to . For example, , and . (As a reminder, the greatest common divisor (gcd) of two positive integers and is the greatest positive integer that divides both and . Two positive integers are relatively prime if their gcd is .)

Euler's product formula gives the value of in terms of the prime factorization of . For a prime , let be the highest power of which divides (so for example, , , and ). If is a product of powers of prime factors, (where the product only includes primes with ), then

A recent edition of The American Mathematical Monthly (Li et al., Positive Rational Numbers of the Form , 128(2), 2021) proved the following fact about totient quotients: for any pair of positive integers , there is a unique pair of positive integers , for which:

  • if a prime divides the product , then ;
  • is square-free: that is, for every prime , is not divisible by .

Conditions 2 and 3 guarantee that and are the unique smallest pair of positive integers satisfying condition 1.

You'd like to verify this claim numerically. Write a program which takes as input two integers and and outputs the corresponding pair .

输入格式

The only line of input contains two space-separated integers and (). These two integers are guaranteed to be relatively prime. Additionally, and will be chosen so that output values and are less than .

输出格式

Print the two positive integers and satisfying all three of the conditions of The American Mathematical Monthly's theorem, separated by a space. It is guaranteed that .

样例

样例输入 1

9 13

样例输出 1

18 13

样例输入 2

19 47

样例输出 2

13110 18612