汪苏泷三国杀视频:请问2017和87960787分别是质数还是合数?

来源:百度文库 编辑:神马品牌网 时间:2024/05/02 06:49:32
请问2017和87960787分别是质数还是合数?

我编写了一个分解质因数的程序,用Visual Basic编的。
证实2017是质数,87960787也是质数。
不信的话,我给你源代码看。

VERSION 5.00
Begin VB.Form 分解质因数
Caption = "分解质因数"
ClientHeight = 3150
ClientLeft = 60
ClientTop = 390
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3150
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox b
Height = 1935
Left = 240
Locked = -1 'True
MultiLine = -1 'True
TabIndex = 3
Top = 1080
Width = 4095
End
Begin VB.CommandButton Command1
Appearance = 0 'Flat
Caption = "确定"
Height = 375
Left = 3240
TabIndex = 2
Top = 360
Width = 975
End
Begin VB.TextBox a
Height = 270
Left = 240
MaxLength = 15
TabIndex = 1
Top = 360
Width = 1695
End
Begin VB.Label Label1
Caption = "结果"
Height = 255
Left = 240
TabIndex = 4
Top = 840
Width = 1095
End
Begin VB.Label T
Caption = "请输入正整数(3-999999999999999)"
Height = 255
Left = 240
TabIndex = 0
Top = 120
Width = 3615
End
End
Attribute VB_Name = "分解质因数"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
a = Int(Val(a)): d = a
If a < 3 Or a > 999999999999999# Then b = "你的输入不合法!": a = "": GoTo 2
c = 2
While c <= Sqr(d)
If d / c = Int(d / c) Then GoTo 1
c = c + 1
Wend
b = Format(d) + "是质数"
GoTo 2
1 b = Format(d) + " =" + Str(c) + " *"
d = d / c
While c <= Sqr(d)
If d / c = Int(d / c) Then b = b + Str(c) + " *": d = d / c Else c = c + 1
Wend
b = b + Str$(d)
2 End Sub

2017和87960787都是质数

0既不是质数也不是合数
一和它本身能整除该数的叫质数.
除了一和它本身能整除该数的还有别的数可以整除它的数是合数

都是质数
因为只有3*9才能得到7结尾的,2017试着除以3,913,19,23,29,33,39,43,49,53,59没有合适的故为质数
同理的下面

2017、87960787都是质数