Tap here to switch tabs
Problem
Submissions

Problem: Ugly Number II

Ugly Number II asks you to return the positive integer at a given position in the sequence of numbers whose prime factors are only 2, 3, and 5, with 1 included.

Statement

Given an integer n, return the nth ugly number.

An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5.

Note: 1 is considered an ugly number.

Constraints:

  • 1≤1 \leq n ≤1690\leq 1690

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Ugly Number II

Ugly Number II asks you to return the positive integer at a given position in the sequence of numbers whose prime factors are only 2, 3, and 5, with 1 included.

Statement

Given an integer n, return the nth ugly number.

An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5.

Note: 1 is considered an ugly number.

Constraints:

  • 1≤1 \leq n ≤1690\leq 1690