Calculate the nth prime with Python
#!/usr/bin/env python3
import sys
import time; max=int(sys.argv[1]); n=1; p=1
t0 = time.perf_counter()
while n<=max:
f=0; j=2; s = int(p**0.5)
while f < 1:
if j >= s:
f=2
if p % j == 0:
f=1
j+=1
if f != 1:
n+=1;
#print(n,p);
p+=1
t1 = time.perf_counter()
print(f"n = {max}")
print(f"nth prime = {p-1}")
print(f"Elapsed time = {t1-t0:.6f} seconds")
