Python: 10001st Prime
Python: 10001st Prime
Problem No.7 @ ProjectEuler
This is one of shot projects you may find on ProjectEuler, the task is find the prime No 10001, I just run my is_prime function, if the number is prime will add 1 to the counter, until we reach 10001, that will be the answer.
![]() |
The Code:
# 10001st prime
# Problem 7
# Solved: Wed, 26 Jun 2019, 05:57am (GMT+3)
def is_prime(num):
result = True
for t in range (2,num):
if num%t==0 :
result= False
break
return result
p_count=0
num =0
while p_count <=10001:
num +=1
if is_prime (num):
p_count +=1
print(p_count,num)
print(num,p_count-1)
Categories: Problem, Projects/Experiments, Python
ahradwani.com, Ali, Code, Computer, doha, Language, Problem, ProjectEuler, Python, Qatar, radwani
Comments (0)
Trackbacks (0)
Leave a comment
Trackback