let (|One|_|) x = if x = 1 then Some x else None
let (|Even|_|) x = if x % 2 = 0 then Some x else None
let lenth x =
let rec calc num pos =
match num with
| One i -> 1, pos
| Even i -> calc (i / 2) (pos + 1)
| _ -> calc (num * 3 - 1) ( pos + 1)
let i pos = calc x 0
i
printfn "%i" (lenth 10)