from math import sqrt
defprime_up_to(n):
L=[True]*(n+1)for i inrange(2,round(sqrt(n))+1):if L[i]:# if L[i] is true
e=i*i
while e<=n:
L[e]=False# the no-prime becone false
e+=i
return[i for i inrange(2,n+1)if L[i]]# output i if i is trueprint(prime_up_to(100))
找质数from math import sqrtdef prime_up_to(n): L= [True]*(n+1) for i in range(2,round(sqrt(n))+1): if L[i]: # if L[i] is true e=i*i while e&amp;lt;=n: ...