PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000140. Số nhỏ nhất có các ước cách xa nhau (Different Divisors)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Số nhỏ nhất có các ước cách xa nhau (Different Divisors)
Different Divisors
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
You are given a positive integer . Find the smallest positive integer satisfying both conditions:
- has at least four distinct positive divisors;
- the absolute difference between any two distinct positive divisors of is at least .
For example, with , the number is invalid because it has divisors and differing by .
Input
One line contains the integer .
Output
Print the smallest positive integer satisfying both conditions.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
2
Output
15
Explanation
For , the positive divisors of are . Their consecutive differences are , all at least . Thus all divisor pairs satisfy the condition. No smaller positive integer with at least four divisors does so, hence the output is 15.