(define (weird x)
  (define (iter x count)
    (cond ((= x 1) count)
          ((even? x) (iter (/ x 2) (+ count 1)))
          (else (iter (+ (* 3 x) 1) (+ count 1)))))
  (iter x 1))