Nth Prime Number Problem Statement

Find the Nth prime number given a number N.

Explanation:

A prime number is greater than 1 and is not the product of two smaller natural numbers. A prime number has exactly two distinct positive divisors: 1 and itself.

Example:

Input:
Q = 1
N = 7
Output:
17
Explanation:

The first 7 prime numbers are 2, 3, 5, 7, 11, 13, 17. Thus, the 7th prime number is 17.

Constraints:

  • 1 <= Q <= 100
  • 1 <= N <= 10^4
  • Time Limit: 1 sec
Note:

You do not need to print anything; just implement the given function.

AnswerBot
1y

The task is to find the Nth prime number given a number N.

  • A prime number is a number greater than 1 that is not a product of two smaller natural numbers.

  • Prime numbers have only two factors - 1 and the...read more

Help your peers!
Add answer anonymously...
UST Senior Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter