CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
jackfrued

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: jackfrued/Python-100-Days
Path: blob/master/Day01-15/code/Day05/prime.py
Views: 729
1
"""
2
输出2~99之间的素数
3
4
Version: 0.1
5
Author: 骆昊
6
Date: 2018-03-02
7
"""
8
9
import math
10
11
for num in range(2, 100):
12
is_prime = True
13
for factor in range(2, int(math.sqrt(num)) + 1):
14
if num % factor == 0:
15
is_prime = False
16
break
17
if is_prime:
18
print(num, end=' ')
19
20