#P10618. [ICPC2013 WF] Factors

[ICPC2013 WF] Factors

题目描述

The fundamental theorem of arithmetic states that every integer greater than 11 can be uniquely represented as a product of one or more primes. While unique, several arrangements of the prime factors may be possible. For example:

  • 10=2×5=5×210=2\times 5=5\times 2
  • $20=2\times 2\times 5=2\times 5\times 2=5\times 2\times 2$;

Let f(k)f(k) be the number of different arrangements of the prime factors of kk. So f(10)=2f(10) = 2 and f(20)=3f(20) = 3.

Given a positive number nn, there always exists at least one number kk such that f(k)=nf(k) = n. We want to know the smallest such kk.

输入格式

The input consists of at most 10001 000 test cases, each on a separate line. Each test case is a positive integer n<263n < 2^{63}.

输出格式

For each test case, display its number nn and the smallest number k>1k > 1 such that f(k)=nf(k) = n. The numbers in the input are chosen such that k<263k < 2^{63}.

题目大意

【题目描述】

算术基本定理指出,每个大于 11 的整数都可以唯一表示为一个或多个素数的乘积。虽然表示是唯一的,但素数因子的排列可能有多种。例如:

  • 10=2×5=5×210=2\times 5=5\times 2
  • $20=2\times 2\times 5=2\times 5\times 2=5\times 2\times 2$;

f(k)f(k)kk 的素数因子不同排列的数量。因此,f(10)=2f(10) = 2f(20)=3f(20) = 3

给定一个正整数 nn,总是至少存在一个数字 kk 使得 f(k)=nf(k) = n。我们想知道最小的这样的 kk

【输入格式】

输入包含最多 10001 000 个测试用例,每个测试用例占一行。每个测试用例是一个正整数 n<263n < 2^{63}

【输出格式】

对于每个测试用例,输出其数字 nn 以及最小的 k>1k > 1 使得 f(k)=nf(k) = n。输入中的数字选择使得 k<263k < 2^{63}

翻译来自于:ChatGPT

1
2
3
105
1 2
2 6
3 12
105 720