A program I wrote in AppleScript to explore Collatz Conjecture.

read moreset returnednumbers to {}
repeat with incrementer from 1 to 100
set numberInQuestion to incrementer
set numberOfIterations to 0
repeat while numberInQuestion is not equal to 1
if numberInQuestion mod 2 is 1 then
set numberInQuestion to ((numberInQuestion * 3) + 1)
else
set numberInQuestion to (numberInQuestion / 2)
end if
set numberOfIterations to (numberOfIterations + 1)
end repeat
set end of returnednumbers to numberOfIterations
set end of returnednumbers to " "
end repeat
return returnednumbers as string
--the numbers that are spit out give the number iterations required for the number in the sequence to reach 1