% hailstone procedure. p. 6

while (x ~= 1)
  if (mod(x,2)==1) 
   x=3*x+1
   else x=x/2
  end
end

