Sub main()
Dim b&, i&, k&, m&, n&, w&
Debug.Print "..."
m = InputBox("m=")
n = InputBox("n=")
For i = m To n
Debug.Print i; "=";
b = i: k = 2
While k <= Sqr(i)
If b Mod k = 0 Then
b = b / k
If b > 1 Then
Debug.Print k; "*";
GoTo 1
End If
If b = 1 Then Debug.Print k
End If
k = k + 1
1:
Wend
If b > 1 And b < i Then Debug.Print b
If b = i Then Debug.Print "素数": w = w + 1
Next
Debug.Print w; "个素数"
End Sub