Problem Statement You are given an integer K K greater than or equal to 2 2. Find the…
- User
Problem Statement You are given an integer K K greater than or equal to 2 2. Find the minimum positive integer N N such that N ! N! is a multiple of K K.
Here, N ! N! denotes the factorial of N N. Under the Constraints of this problem, we can prove that such an N N always exists.
Constraints 2 ≤ K ≤ 1 0 12 2≤K≤10 12
K K is an integer. Input The input is given from Standard Input in the following format:
K K Output Print the minimum positive integer N N such that N ! N! is a multiple of K K.
Sample 1 Inputcopy Outputcopy 30 5 1 !
1 1!=1 2 !
2 × 1
2 2!=2×1=2 3 !
3 × 2 × 1
6 3!=3×2×1=6 4 !
4 × 3 × 2 × 1
24 4!=4×3×2×1=24 5 !
5 × 4 × 3 × 2 × 1
120 5!=5×4×3×2×1=120 Therefore, 5 5 is the minimum positive integer N N such that N ! N! is a multiple of 30 30. Thus, 5 5 should be printed.
Sample 2 Inputcopy Outputcopy 123456789011 123456789011 Sample 3 Inputcopy Outputcopy 280 7 Bu suala necə yanaşa bilərəm?c++da
- Assistant