Scala LazyList
\nimport scala.collection.SortedSet\n\nobject Solution {\n  def nthSuperUglyNumber(n: Int, primes: Array[Int]): Int = {\n    def f(ugly: SortedSet[Long]): LazyL
```\nimport scala.collection.SortedSet\n\nobject Solution {\n  def nthSuperUglyNumber(n: Int, primes: Array[Int]): Int = {\n    def f(ugly: SortedSet[Long]): LazyList[Long] = {\n      ugly.head #:: f(ugly.tail ++ primes.map(_ * ugly.head))\n    }\n    f(SortedSet(1))(n - 1).toInt\n  }\n}\n```
['Scala']