: iterate ( n -- n ) dup odd? [ 3 * 1 + ] [ 2 / ] if ; : cyclelength ( n -- n ) 0 swap [ dup 1 = not ] [ swap 1+ swap iterate ] while drop ;