10,001st prime number

What is the 10,001st prime number?


Try other problems Here


The answer is 104743.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
public class Main {
    public static void main(String[] args) {
        int number = 1, prime = 1, divide;
        while (number < 10001) {
            prime = prime + 2;
            divide = 1;
            while (true) {
                divide = divide + 2;
                if (prime == divide) {
                    number++;
                    break;
                } else if (prime % divide == 0 && prime != divide) {
                    break;
                }
            }
        }
        System.out.println("The " + number + " prime is: " + prime);
    }
}

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...