For this case, a number is defined ugly if it has prime factors consisting of only elements of x. Find the nth ugly number.
- x=[2,3,5] and n=10.
- So the list is like -- 2,3,4,5,6,8,9,10,12,15...
so the ans is 15.
Solution Stats
Problem Comments
1 Comment
Solution Comments
Show comments
Loading...
Problem Recent Solvers23
Suggested Problems
-
Replace NaNs with the number that appears to its left in the row.
3064 Solvers
-
Construct an index vector from two input vectors in vectorized fashion
449 Solvers
-
Convert to Binary Coded Decimal
152 Solvers
-
123 Solvers
-
count upper and lower case characters
55 Solvers
More from this Author174
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Unlike the previous two "ugly()" problems, in this one it appears that the number "1" is not considered ugly.