i don't get it so what's the question?

you have an integer value i from 0 to 30K and the formula for finding primes.

Anyway here is a version using the sieve of eratosthenes from you first semester discrete mathematics course.

Code:

Private Function IsPrime(ByVal Number As Long)
IsPrime = False
Dim I As Long
For I = LBound(Primes) To UBound(Primes)
DoEvents
If (Number Mod Primes(I) = 0) Then Exit Function
If (Primes(I) >= Sqr(Number)) Then Exit For
Next
IsPrime = True
End Function
Private Sub BuildPrimes(ByVal Max As Long)
If (Max < 3) Then Exit Sub
Dim I As Long
For I = 2 To Max
If (IsPrime(I)) Then
ReDim Preserve Primes(UBound(Primes) + 1) As Long
Primes(UBound(Primes)) = I
End If
Next
End Sub
Private Sub DoIt()
ReDim Primes(0)
Primes(0) = 2
BuildPrimes 30000
End Sub