Project Euler has quickly become my hobby for when I have small moments of free time. Here is problem #7:
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10001st prime number?
and this is my brute force solution:
Public Sub GetPrime() Dim iPrimeMax As Integer = 10001 Dim iPrimeCounter As Integer = 0 Dim iCurrentNum As Integer = 2 While (iPrimeCounter < iPrimeMax) Dim bPrime As Boolean = True Dim iCounter As Integer = 1 While (bPrime = True And iCounter < iCurrentNum) If (iCurrentNum Mod iCounter = 0 And iCounter <> 1) Then bPrime = False End If iCounter += 1 End While If (bPrime = True) Then iPrimeCounter += 1 End If iCurrentNum += 1 End While Response.Write((iCurrentNum - 1).ToString()) End Sub