Nth ugly number

Write codeMedium22 min

Your task

An ugly number is a positive integer whose only prime factors are 2, 3, and 5. The sequence begins 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, ... (1 is included by convention). Given n (1 <= n <= 1690), return the nth ugly number. The answer fits in a 64-bit integer.

Examples

nth_ugly_number(n: int) -> int
Example 1
Inputnth_ugly_number(10)
Output12