【正确答案】Option Explicit
Private Sub CmdFind_Click()
Dim n1 As Integer, n2 As Integer, i As Integer
Dim k As Integer, js As Integer, st As String
n1 = Text1: n2 = Text2
For i = n1 To n2
k = Padovan(i)
st = st & Str(k)
js = js + 1
If js Mod 10 = 0 Then
st = st & vbCrLf
End If
If prime(k) Then
List1.AddItem k & "--(" & i & ")"
End If
Next i
Text3 = st
End Sub
Private Function Padovan(n As Integer) As Integer
If n = 0 Or n = 1 Or n = 2 Then
Padovan = 1
Else
Padovan = Padovan(n - 2) + Padovan(n - 3)
End If
End Function
Private Function prime(n As Integer) As Boolean
Dim i As Integer
If n = 1 Then Exit Function
For i = 2 To Sqr(n)
If n Mod i = 0 Then Exit Function
Next i
prime = True
End Function
Private Sub CmdClear_click()
Text1 = "": Text2 = "": Text3 = ""
List1.Clear
Text1.SetFocus
End Sub
Private Sub CmdExit_click()
End
End Sub