nth Prime Number Java - Javatpoint
https://www.javatpoint.com/nth-prime-number-javaSo, we need to print all the prime numbers less than or equal to n. Let's create a list of the numbers starting from 2 to 20. In the above table, mark all the numbers that are divisible by 2 (we have marked by red color), also greater than or equal to the square of it. After the first prime (2) and unmarked number, the next unmarked number is 3.