24 lines
494 B
Plaintext
24 lines
494 B
Plaintext
Declare Function hailstone Alias "hailstone" (Byval arg As Uinteger) As Uinteger
|
|
|
|
Dim Shared freq(351) As Uinteger
|
|
|
|
For number As Uinteger = 2 To 100000
|
|
Dim seqlen As Uinteger = hailstone(number)
|
|
freq(seqlen) += 1
|
|
Next
|
|
|
|
Dim max As Uinteger = 0
|
|
Dim mostcommon As Uinteger
|
|
|
|
For i As Uinteger = 0 To 351
|
|
If freq(i) > max Then
|
|
max = freq(i)
|
|
mostcommon = i
|
|
End If
|
|
Next
|
|
|
|
Print "The most common sequence length is "; mostcommon
|
|
Print "It occurs "; max; " times"
|
|
|
|
Sleep
|