(* _Michael De Vlieger_, April 19, 2024 *) (* memoizes A060445 and samples as necessary to generate A177789 *) (* otherwise, functions essentially the same as Tony Noe's program *) c = 1 + Log2[3]; (* constant *) nn = 14; (* rows to generate, minus 1 *) (* generate dropping times for odd numbers less than a threshold *) s = {1}~Join~Table[-1 + Length@ NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, k, # >= k &], {k, 2 Range[Floor[#/2] - 1] + 1}] &[2^Floor[Log2[3^(nn - 1)] + 1]]; (* ^ A060445 *) {{0}, {1}}~Join~Reap[ Do[m = 2^Floor[Log2[3^(n - 1)] + 1]; (* 2^A020914 *) t = Floor[1 + c (n - 1)]; (* A122437 *) Sow[2 Position[s[[;; Floor[m/2] - 1]], t][[All, 1]] - 1], {n, 3, nn}] ][[-1, 1]] // Flatten