猫史档案馆


9592个质数是如何炼成的

用户:小苏打_小苏打_查看:0 回复:1 评论:0 创建时间:2020-10-04T22:15:45


#!/usr/bin/python
a=0
i=0
b=0
c=0
d=[]
a=input('please input a number..\n')
a=int(a)
for i in range(2,a):
	for b in range(2,i):
		if i%b==0 :
			c+=1
	if c==0:
		print(str(i)+' is a Prime number!')
		d.append(i)
	else:
		print(str(i)+' is not prime number.')
	c=0
print('\n1 ~ '+str(a)+' is have '+str(len(d))+' prime number.')
print(d)

input('\n\nplease type \'Enter\' to next... ')

这只是1.0版

2.0版有更多功能:查询、切片、保存,想要的在评论区说一声

 

p.s.想看看9592个质数具体是什么吗?

    =>https://shequ.codemao.cn/community/344522

    =>https://shequ.codemao.cn/community/344525


回复

上一页1 页 / 共 1下一页
小苏打_小苏打_

以上程序可以在https://wood.codemao.cn上正常运行(无需下载任何库)

赶紧去试试吧!

点赞0


评论