Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
28
Task/Executable-library/AutoHotkey/executable-library-1.ahk
Normal file
28
Task/Executable-library/AutoHotkey/executable-library-1.ahk
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#NoEnv
|
||||
SetBatchLines, -1
|
||||
|
||||
; Check if we're executed directly:
|
||||
If (A_LineFile = A_ScriptFullPath){
|
||||
h27 := hailstone(27)
|
||||
MsgBox % "Length of hailstone 27: " (m := h27.MaxIndex()) "`nStarts with "
|
||||
. h27[1] ", " h27[2] ", " h27[3] ", " h27[4]
|
||||
. "`nEnds with "
|
||||
. h27[m-3] ", " h27[m-2] ", " h27[m-1] ", " h27[m]
|
||||
|
||||
Loop 100000
|
||||
{
|
||||
h := hailstone(A_Index)
|
||||
If (h.MaxIndex() > m)
|
||||
m := h.MaxIndex(), longest := A_Index
|
||||
}
|
||||
MsgBox % "Longest hailstone is that of " longest " with a length of " m "!"
|
||||
}
|
||||
|
||||
|
||||
hailstone(n){
|
||||
out := [n]
|
||||
Loop
|
||||
n := n & 1 ? n*3+1 : n//2, out.insert(n)
|
||||
until n=1
|
||||
return out
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue