Project Euler #7: 10001st prime

  • + 3 comments
    import sys
    import math
    
    t = int(input().strip())
    for a0 in range(t):
        n = int(input().strip())
        if n<=10**5 and n>=1:
            vb=0
            b=2
            while vb!=n:
                sr=0
                for i in range(2,int(math.sqrt(b))+1):
                    if b%i==0:
                        sr=1
                        break
                if sr==0:
                    vb+=1
                b+=1
            print(b-1)