The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
Function Prob003() As Long
Dim Src As Long = 600851475143
Dim PrimeCol As New Collection
For tmpVal As Long = 2 To Src
If tmpVal > System.Math.Sqrt(Src) Then Exit For
If IsPrime(tmpVal) = True Then
For k As Integer = 1 To PrimeCol.Count
If Src Mod PrimeCol(k) = 0 Then
If PrimeCol(k) > Prob003 Then Prob003 = PrimeCol(k)
This one was kind of a pain. I had forgotten a lot about what makes a prime and the various rules, tricks, etc. when dealing with them…