早教吧 育儿知识 作业答案 考试题库 百科 知识分享

请问2017和87960787分别是质数还是合数?

题目详情
请问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