Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module CollatzSequence 'My solution to Project Euler Problem 14
- Sub Main()
- Dim Nbr As Int64, Cnt As Integer = 0
- For i = 2 To 1000000
- Dim CrntNbr As Int64 = i, CrntCnt As Integer = 0
- While Not CrntNbr = 1
- If CrntNbr Mod 2 = 0 Then CrntNbr /= 2 Else CrntNbr = 3 * CrntNbr + 1
- CrntCnt += 1
- End While
- If CrntCnt > Cnt Then
- Cnt = CrntCnt : Nbr = i
- End If
- Next : Console.WriteLine(Nbr)
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement