9^n+2是不是质数vb编程如下Private Sub Command1_Click()Dim a As IntegerDim b As IntegerDim c As Singlea = 1b = 2Do Until c - intc = 0Do Until c - intc = 0 Or 9 ^ a - 3

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/27 12:44:32
9^n+2是不是质数vb编程如下PrivateSubCommand1_Click()DimaAsIntegerDimbAsIntegerDimcAsSinglea=1b=2DoUntilc-intc=

9^n+2是不是质数vb编程如下Private Sub Command1_Click()Dim a As IntegerDim b As IntegerDim c As Singlea = 1b = 2Do Until c - intc = 0Do Until c - intc = 0 Or 9 ^ a - 3
9^n+2是不是质数
vb编程如下
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
Dim c As Single
a = 1
b = 2
Do Until c - intc = 0
Do Until c - intc = 0 Or 9 ^ a - 3

9^n+2是不是质数vb编程如下Private Sub Command1_Click()Dim a As IntegerDim b As IntegerDim c As Singlea = 1b = 2Do Until c - intc = 0Do Until c - intc = 0 Or 9 ^ a - 3
不是,n=0,1,2,4..都是,但n=3时不是
当n=3时,9^3+2=731=17*43

如果是9^N+2就不是,如果是(9^N)+2也不是,因为N为负数的话,就为分数,分数不是质数。