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
4mo

To find the Nth prime number given a number N, implement a function that returns the Nth prime number.

  • Create a function that takes N as input and returns the Nth prime number.

  • Use a loop to iterate thr...read more

Help your peers!
Select
Add answer anonymously...

Siemens Senior Systems Engineer interview questions & answers

A Senior Systems Engineer was asked Q. What makes a HashSet different from a TreeSet?
A Senior Systems Engineer was asked Q. What is thread starvation?
A Senior Systems Engineer was asked Q. What are the start() and run() methods of the Thread class?

Popular interview questions of Senior Systems Engineer

A Senior Systems Engineer was asked Q1. What makes a HashSet different from a TreeSet?
A Senior Systems Engineer was asked Q2. What is thread starvation?
A Senior Systems Engineer was asked Q3. What are the start() and run() methods of the Thread class?
Siemens Senior Systems Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
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

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

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits