[back]

Total Stopping Time Records

We consider a different sequence based on the Collatz conjecture. The number collatz n is sometimes called the total stopping time of n. We say that n has a total stopping time record if its total stopping time is greater than that of any previous number. That is, n has a total stopping time record if collatz m < collatz n for all positive m less than n.

Implement the function

val tst_record : int -> int

so that tst_record n is the \(n\)th number with a total stopping time record.

Examples

let _ = assert (tst_record 0 = 1)
let _ = assert (tst_record 1 = 2)
let _ = assert (tst_record 2 = 3)
let _ = assert (tst_record 3 = 6)
let _ = assert (tst_record 4 = 7)
let _ = assert (tst_record 5 = 9)
let _ = assert (tst_record 6 = 18)
let _ = assert (tst_record 7 = 25)