K-th Number With Factors 3, 5 and 7

Practice K-th Number With Factors 3, 5 and 7 for free on NudgeCode: Medium, Heap pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Return the k-th smallest number of the form 3^x * 5^y * 7^z with x, y, z >= 1: it has each of 3, 5 and 7 as a factor at least once and no other prime factor.

Example

k = 1  ->  105   (3 * 5 * 7)
k = 2  ->  315   (105 * 3)
k = 3  ->  525   (105 * 5)

Constraints

Similar to LC 264 (Ugly Number II), which uses factors 2, 3, 5 and allows exponent 0.