
Asked in UnitedHealth
Prime Numbers in Interval Problem Statement
You are provided with a positive integer N
. Your task is to return all the prime numbers that are less than or equal to N
.
Input:
The input consists of an integer 'T' representing the number of test cases. Each test case contains one integer 'N'.
Output:
For each test case, return a list of prime numbers less than or equal to 'N' in ascending order.
Example:
Input:
3
10
5
20
Output:
[2, 3, 5, 7]
[2, 3, 5]
[2, 3, 5, 7, 11, 13, 17, 19]
Note:
- A prime number is a number greater than 1 that has no factors other than 1 and itself.
- 1 is not considered a prime number.
- No need to print the output; just implement the function to return the desired output.
Constraints:
1 <= T <= 100
2 <= N <= 5000
Time Limit: 1 second

AnswerBot
4mo
Return all prime numbers less than or equal to a given positive integer N.
Create a function that takes an integer N as input
Iterate from 2 to N and check if each number is prime
Return a list of prime ...read more
Help your peers!
Add answer anonymously...
Top Business Analyst Interview Questions Asked at UnitedHealth
Q. Estimate the percentage of smokers in the institute.
Q. There are 20 blue balls and 13 red balls in a container. You randomly pick 2 bal...read more
Q. How many Facebook users are there in the world?
Interview Questions Asked to Business Analyst at Other Companies
Top Skill-Based Questions for UnitedHealth Business Analyst
SQL Interview Questions and Answers
250 Questions
Software Development Interview Questions and Answers
250 Questions
Agile Methodology Interview Questions and Answers
250 Questions
Web Development Interview Questions and Answers
250 Questions
Agile Interview Questions and Answers
50 Questions
SDLC Interview Questions and Answers
50 Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

