﻿c=1v=:i a=1-v%2v+=a*(v/2-v)b=v%2*(v>1)v+=b*((3*v+1)/2-v)c+=a+b*2
a=1-v%2v+=a*(v/2-v)b=v%2*(v>1)v+=b*((3*v+1)/2-v)c+=a+b*2goto2/(v>1)
:o=c goto:done++

/--------//--------//--------//--------//--------//--------//--------/

c=1v=:i
a=1-v%2v+=a*(v/2-v)b=v%2*(v>1)v+=b*((3*v+1)/2-v)c+=a+b*2goto2/(v>1)
:o=c goto:done++

/--------//--------//--------//--------//--------//--------//--------/

v=:i c=1 if v==1 then goto10 else goto4 end
v=v/2 c++ if v==1 then goto10 else goto4 end
v=(3*v+1)/2 c+=2 goto4
f=(v-4)/8if(f%1==1)then v=6*f+4c+=3end goto2+(v%2)


// any number of the form 8k+4 will reach 6k+4 after 3 steps
// and so will any number of the form 8k+5

:o=c goto:done++

/--------//--------//--------//--------//--------//--------//--------/

c=1v=:i goto3+(v==1)*6+(v!=1)*(v%2)*3

v/=2c++x/=(v!=22)*(v!=88)*(v!=58)*(v!=76)goto3+(v==1)*6+(v!=1)*(v%2)*3
c+=(22==v)*15+(88==v)*17+(58==v)*19+(76==v)*22 :o=c goto:done++

x/=(v!=29)*(v!=11)*(v!=19)*(v!=101)v=(3*v+1)/2c+=2 goto3+(v%2)*3
c+=(29==v)*18+(11==v)*14+(19==v)*20+(101==v)*25 :o=c goto:done++

:o=c goto:done++


/--------//--------//--------//--------//--------//--------//--------/

c=1v=:i goto3+(v==1)*6+(v!=1)*(v%2)*3

v/=2c++x/=(v!=52)*(v!=80)*(v!=64)*(v!=96)goto3+(v==1)*6+(v!=1)*(v%2)*3
c+=11*(v==52)+9*(v==80)+6*(v==64)+12*(v==96) :o=c goto:done++

v=3*v+1c++goto3+(v==1)*6+(v!=1)*(v%2)*3


:o=c goto:done++

/--------//--------//--------//--------//--------//--------//--------/

v=:i c=1 goto2+(v==1)*2+(v!=1)*(v%2)
if v==40then c+=8goto4end v=v/2 c++ goto2+(v==1)*2+(v!=1)*(v%2)
if v==17then c+=12goto4end v=3*v+1 c++ goto2+(v==1)*2+(v!=1)*(v%2)
:o=c goto:done++

if v==1 then goto4 else goto2+(v%2) end
goto2+(v==1)*2+(v!=1)*(v%2)

/--------//--------//--------//--------//--------//--------//--------/

v=:i c=1 if v==1 then goto4 else goto2+(v%2) end
v=v/2 c++ if v==1 then goto4 else goto2+(v%2) end
v=(3*v+1)/2 c+=2 goto2
:o=c goto:done++

/--------//--------//--------//--------//--------//--------//--------/

Sequence Lengths listed in order of frequency (top is most frequent):
2   => 2
4   => 3
8   => 4
16  => 5
5   => 6
10  => 7
20  => 8
40  => 9
80  => 10 x
160 => 11
13  => 10
26  => 11
52  => 12 x
53  => 12
106 => 13
35  => 14
70  => 15
17  => 13
34  => 14
23  => 16

52 => 12
80 => 10
64 => 7
96 => 13