Prime Again!

What is the 2500 1 st 25001^\text{st} prime number ?


The answer is 287137.

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

Python:

def isPrime(n):
    if n==1:
        return False
    else:
        for i in range(2,round(n**0.5)+1):
            if n%i==0:
                return False
        return True

count = 0
num = 0
while count<25001:
    num+=1
    if isPrime(num):
        count+=1

Yes did it the same way

Saarthak Marathe - 5 years, 1 month ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...