You are given two integers L and R. Your task is to return all prime numbers in the inclusive range [L, R], arranged in ascending order.
A prime number is an integer greater than 1 that has exactly two distinct positive divisors: 1 and itself. If the range contains no prime numbers, return an empty result.
Input: L = 10, R = 20
Output: 11 13 17 19
Explanation: The prime numbers between 10 and 20, inclusive, are 11, 13, 17, and 19.
Input: L = 1, R = 5
Output: 2 3 5
Explanation: The prime numbers between 1 and 5, inclusive, are 2, 3, and 5. The number 1 is not prime.
Input: L = 14, R = 16
Output: (empty)
Explanation: None of the numbers from 14 through 16 is prime, so the result is empty.
Sign in to write, run, and submit your solution against the full test suite.