N-interesting Numbers
Time limit5sMemory limit512 MB
Given N and n, find the n-th largest number X whose largest prime factor p is at most 127 and satisfies p^k at most N, where k counts the prime factors.
- Level
Medium7 of 10
- Topics
- Backtracking, Number theory, Sorting
- Solved
- No attempts yet
Statement
An integer is called -interesting if, in its prime factorization , the largest factor satisfies and .
You are given two integers and . It is guaranteed that at least -interesting numbers exist and that there are finitely many of them. Find the -th largest -interesting number.
Input
The first line contains two integers and (; ).
Output
Print one integer: the -th largest -interesting number.