主题:关于素数的题向你们请教一下,十万火急呀
多阳天使
[专家分:0] 发布于 2005-06-02 10:28:00
请各位大哥大姐关照一下,我实在不会呀,
回复列表 (共19个回复)
11 楼
moz [专家分:37620] 发布于 2005-08-27 08:23:00
1不是素数(质数)
[url=http://www.programfan.com/club/showbbs.asp?id=90603]关于质数的检查和计算,请看这一贴[/url]
12 楼
dorremon1992 [专家分:870] 发布于 2005-08-28 10:37:00
on error resume next
input a
if a<=1 then print("Data Error")
SS=True
for i= 2 to int(sqr(a))
if a mod i =0 then SS=false
next i
if SS=True then print("Su Shu")
else print("NO Su Shu")
End
13 楼
dorremon1992 [专家分:870] 发布于 2005-08-28 10:38:00
on error resume next
input a
if a<=1 then print("Data Error")
SS=True
for i= 2 to int(sqr(a))
if a mod i =0 then SS=false
next i
if SS=True then print("Su Shu")
else print("NO Su Shu")
End
14 楼
dorremon1992 [专家分:870] 发布于 2005-08-28 10:38:00
on error resume next
input a
if a<=1 then print("Data Error")
SS=True
for i= 2 to int(sqr(a))
if a mod i =0 then SS=false
next i
if SS=True then print("Su Shu")
else print("NO Su Shu")
End
15 楼
dorremon1992 [专家分:870] 发布于 2005-08-28 10:39:00
on error resume next
input a
if a<=1 then print("Data Error")
SS=True
for i= 2 to int(sqr(a))
if a mod i =0 then SS=false
next i
if SS=True then print("Su Shu")
else print("NO Su Shu")
End
16 楼
dorremon1992 [专家分:870] 发布于 2005-08-28 10:40:00
on error resume next
input a
if a<=1 then print("Data Error")
SS=True
for i= 2 to int(sqr(a))
if a mod i =0 then SS=false
next i
if SS=True then print("Su Shu")
else print("NO Su Shu")
End
17 楼
dorremon1992 [专家分:870] 发布于 2005-08-28 10:40:00
on error resume next
input a
if a<=1 then print("Data Error")
SS=True
for i= 2 to int(sqr(a))
if a mod i =0 then SS=false
next i
if SS=True then print("Su Shu")
else print("NO Su Shu")
End
[em11]
18 楼
dorremon1992 [专家分:870] 发布于 2005-08-28 10:41:00
on error resume next
input a
if a<=1 then print("Data Error")
SS=True
for i= 2 to int(sqr(a))
if a mod i =0 then SS=false
next i
if SS=True then print("Su Shu")
else print("NO Su Shu")
End
19 楼
徐天霸 [专家分:0] 发布于 2005-08-31 00:30:00
cls
input n
for i=2 to sqr(n)
if n mod i<>2 then print "n是个素数“
else
print ”n不是个素数“
end if
next i
end
我来回复