A337149 Positive integers k such that the number of steps it takes to reach 1 in the '3x+1' problem is different for all j < k.
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 17, 18, 22, 24, 25, 27, 28, 31, 33, 34, 36, 39, 41, 43, 47, 48, 49, 54, 57, 62, 65, 71, 72, 73, 78, 82, 86, 91, 94, 97, 98, 103, 105, 107, 108, 111, 114, 121, 123, 124, 129, 130, 135, 137, 142, 145, 153, 155, 159
Offset: 1
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..1000
- Wikipedia, Collatz Conjecture
- Index entries for sequences related to 3x+1 (or Collatz) problem
Programs
-
Maple
collatz:= proc(n) option remember; `if`(n=1, 0, 1 + collatz(`if`(n::even, n/2, 3*n+1))) end: b:= proc() 0 end: g:= proc(n) option remember; local t; `if`(n=1, 0, g(n-1)); t:= collatz(n); b(t):= b(t)+1 end: a:= proc(n) option remember; local k; for k from 1+a(n-1) while g(k)>1 do od; k end: a(0):=0: seq(a(n), n=1..100);
-
Mathematica
collatz[n_] := collatz[n] = If[n==1, 0, 1+collatz[If[EvenQ[n], n/2, 3n+1]]]; b[_] = 0; g[n_] := g[n] = Module[{t}, If[n==1, 0, g[n-1]]; t = collatz[n]; b[t] = b[t]+1]; a[n_] := a[n] = Module[{k}, For[k = 1+a[n-1], g[k] > 1, k++]; k]; a[0] = 0; Array[a, 100] (* Jean-François Alcover, Jan 30 2021, after Alois P. Heinz *)
Comments