#abc280d. D - Factorial and Multiple

D - Factorial and Multiple

Score : 400400 points

问题描述

给定一个大于等于2的整数 KK

求最小的正整数 NN,使得 N!N!KK 的倍数。

此处,N!N! 表示 NN 的阶乘。在本问题的约束条件下,可以证明这样的 NN 总是存在。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

You are given an integer KK greater than or equal to 22.
Find the minimum positive integer NN such that N!N! is a multiple of KK.

Here, N!N! denotes the factorial of NN. Under the Constraints of this problem, we can prove that such an NN always exists.

Constraints

  • 2K10122\leq K\leq 10^{12}
  • KK is an integer.

Input

The input is given from Standard Input in the following format:

KK

Output

Print the minimum positive integer NN such that N!N! is a multiple of KK.

Sample Input 1

30

Sample Output 1

5
  • 1!=11!=1
  • 2!=2×1=22!=2\times 1=2
  • 3!=3×2×1=63!=3\times 2\times 1=6
  • 4!=4×3×2×1=244!=4\times 3\times 2\times 1=24
  • 5!=5×4×3×2×1=1205!=5\times 4\times 3\times 2\times 1=120

Therefore, 55 is the minimum positive integer NN such that N!N! is a multiple of 3030. Thus, 55 should be printed.

Sample Input 2

123456789011

Sample Output 2

123456789011

Sample Input 3

280

Sample Output 3

7

update @ 2024/3/10 11:46:11