private sub command1_click()
dim i,j,n
n=val(inputbox("n="))
if IsPrime(n) then
print n & "是素数."
else
for i=n+1 to n+100
if IsPrime(i) then print "大于" & n & "的最小素数是:" & i :Exit For
next
end if
end sub
Function IsPrime(ByVal n As Long) As Boolean
Dim i As Long
if n