envs = (1..12).map do |n|
  Object.new.instance_eval {@n = n; @cnt = 0; self}
end


until envs.all? {|e| e.instance_eval{@n} == 1}
  envs.each do |e|
    e.instance_eval do          
      printf , @n
      if @n > 1
        @cnt += 1               
        @n = if @n.odd?         
               @n * 3 + 1
             else
               @n / 2
             end
      end
    end
  end
  puts
end
puts '=' * 48
envs.each do |e|                
  e.instance_eval do
    printf , @cnt          
  end
end
puts