PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000077. Số may mắn có ba ước nguyên tố (Distinct Primes)
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ố may mắn có ba ước nguyên tố (Distinct Primes)
Distinct Primes
Source: SPOJ
Version: Phuoc Hung OJ Extended
Problem Statement
A positive integer is called lucky when it has at least three distinct prime divisors. For instance, and are the two smallest lucky numbers. Sort all lucky numbers increasingly as . Given , find the element at 1-based position .
Input
One line contains the integer .
Output
Print the -th lucky number.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
2
Output
42
Explanation
The smallest positive integer with at least three distinct prime divisors is . The next is . Since , output 42.