#P8316. K-th Largest n-Pseudo Smooth Number
K-th Largest n-Pseudo Smooth Number
K-th Largest n-Pseudo Smooth Number
An integer \(m > 1\) is defined to be an n-pseudo smooth number if the following condition holds. Let the (not necessarily distinct) prime factorization of \(m\) have \(k\) factors \(a_1, a_2, \dots, a_k\) with \(a_1 \le a_2 \le \cdots \le a_k\). If the largest prime factor \(a_k\) satisfies
[ a_k^{k}\le n, \quad \text{and} \quad a_k \le 397, ]
then \(m\) is called an n-pseudo smooth number.
Given two integers \(n\) and \(k\), find the k-th largest n-pseudo smooth number. It is guaranteed that the answer exists.
inputFormat
The input consists of a single line containing two space-separated integers \(n\) and \(k\).
\(n\) is used in the condition \(a_k^{k} \le n\) and \(k\) denotes that you have to output the k-th largest n-pseudo smooth number.
outputFormat
Output a single integer, the k-th largest n-pseudo smooth number.
sample
10 1
8