atcoder#ABC280D. [ABC280D] Factorial and Multiple

[ABC280D] Factorial and Multiple

Score : 400400 points

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.

30
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.

123456789011
123456789011
280
7