Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
23
Task/Executable-library/FreeBASIC/executable-library-2.basic
Normal file
23
Task/Executable-library/FreeBASIC/executable-library-2.basic
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue