double类型,求double类型的费吗数字?

2022-01-20 06:15 资讯百科 投稿:运河边百科网

Private Function IsPrime(ByVal n As Double) As Boolean

double类型,求double类型的费吗数字?插图

Dim pb As Double

double类型,求double类型的费吗数字?插图1

pb = n – 1

IsPrime = True

For i = 2 To pb

If n Mod i = 0 Then

IsPrime = False

Exit For

End If

Next i

End Function

Private Sub Command1_Click()

For i = 1 To 17

If IsPrime(2 ^ i + 1) = True Then Print 2 ^ i + 1

Next i

End Sub

Private Function Is2n(ByVal n As Double) As Boolean

Is2n = False

If n = 1 Then

Is2n = True

Exit Function

End If

Dim pb As Double

pb = n / 2

Do While pb >= 2

pb = pb / 2

Loop

If pb = 1 Then

Is2n = True

Else

Is2n = False

End If

End Function

类型  数字  double  
声明:运河边百科网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系站长删除。
加载中...