A344276 Number of halving and tripling steps to reach 3 in the '3x+3' problem, or -1 if 3 is never reached.
2, 3, 0, 4, 9, 1, 4, 5, 7, 10, 10, 2, 18, 5, 5, 6, 21, 8, 8, 11, 16, 11, 11, 3, 11, 19, 19, 6, 19, 6, 6, 7, 14, 22, 22, 9, 22, 9, 9, 12, 9, 17, 17, 12, 17, 12, 12, 4, 25, 12, 12, 20, 113, 20, 20, 7, 20, 20, 20, 7, 108, 7, 7, 8, 28, 15, 15, 23, 15, 23, 23, 10
Offset: 1
Keywords
Examples
a(1) = 2, with the trajectory 1 -> 6 -> 3. a(5) = 9, with the trajectory 5 -> 18 -> 9 -> 30 -> 15 -> 48 -> 24 -> 12 -> 6 -> 3.
Links
- Rémy Sigrist, Table of n, a(n) for n = 1..10000
Programs
-
Maple
a:= proc(n) a(n):= 1+a(`if`(n::odd, 3*n+3, n/2)) end: a(3):=0: seq(a(n), n=1..100); # Alois P. Heinz, May 14 2021
-
Mathematica
If[#!=3,#0@If[OddQ@#,3#+3,#/2]+1,0]&/@Range@100 (* Giorgos Kalogeropoulos, May 14 2021 *)
-
PARI
a(n) = for (k=0, oo, if (n==3, return (k), n%2==0, n=n/2, n=3*n+3)) \\ Rémy Sigrist, Jun 13 2021
Formula
a(3) = 0; for all other n > 0, if n is even, a(n) = a(n/2) + 1; if n is odd, a(n) = a(3n+3) + 1.
Comments