Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,14 @@
on hailstone (n, sequenceList)
len = 1
repeat while n<>1
if listP(sequenceList) then sequenceList.add(n)
if n mod 2 = 0 then
n = n / 2
else
n = 3 * n + 1
end if
len = len + 1
end repeat
if listP(sequenceList) then sequenceList.add(n)
return len
end

View file

@ -0,0 +1,16 @@
sequenceList = []
hailstone(27, sequenceList)
put sequenceList
-- [27, 82, 41, 124, ... , 8, 4, 2, 1]
n = 0
maxLen = 0
repeat with i = 1 to 99999
len = hailstone(i)
if len>maxLen then
n = i
maxLen = len
end if
end repeat
put n, maxLen
-- 77031 351