A256598 Irregular triangle where row n contains the odd terms in the Collatz sequence beginning with 2n+1.
1, 3, 5, 1, 5, 1, 7, 11, 17, 13, 5, 1, 9, 7, 11, 17, 13, 5, 1, 11, 17, 13, 5, 1, 13, 5, 1, 15, 23, 35, 53, 5, 1, 17, 13, 5, 1, 19, 29, 11, 17, 13, 5, 1, 21, 1, 23, 35, 53, 5, 1, 25, 19, 29, 11, 17, 13, 5, 1, 27, 41, 31, 47, 71, 107, 161, 121, 91, 137, 103, 155
Offset: 0
Examples
Triangle starts T(0,0): n\k 0 1 2 3 4 5 6 7 8 9 10 ... 0: 1 1: 3 5 1 2: 5 1 3: 7 11 17 13 5 1 4: 9 7 11 17 13 5 1 5: 11 17 13 5 1 6: 13 5 1 7: 15 23 35 53 5 1 8: 17 13 5 1 9: 19 29 11 17 13 5 1 10: 21 1 11: 23 35 53 5 1 12: 25 19 29 11 17 13 5 1 ... n=13 starts with 27 and takes 41 steps: (27), 41, 31, 47, 71, 107,... 53, 5, 1, (see A372443). Row 8 is [17, 13, 5, 1] because it is the subsequence of odd terms for the Collatz sequence starting with 17: [17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1].
Links
- Eric Weisstein's World of Mathematics, Collatz Problem
- Wikipedia, Collatz conjecture
- Index entries for sequences related to 3x+1 (or Collatz) problem
Crossrefs
Programs
-
Mathematica
f[n_] := NestWhileList[(3*# + 1)/2^IntegerExponent[3*# + 1, 2] &, 2*n + 1, # > 1 &]; Grid[Table[f[n], {n, 0, 12}]] (* L. Edson Jeffery, Apr 25 2015 *)
-
PARI
row(n) = {my(oddn = 2*n+1, vl = List(oddn), x); while (oddn != 1, x = 3*oddn+1; oddn = x >> valuation(x, 2); listput(vl, oddn)); Vec(vl);} tabf(nn) = {for (n=0, nn, my(rown = row(n)); for (k=1, #rown, print1(rown[k], ", ")); print;);} \\ Michel Marcus, Oct 04 2019
-
Sage
def Collatz(n): A = [n] b = A[-1] while b != 1: if is_even(b): A.append(b//2) else: A.append(3*b+1) return A [y for sublist in [[x for x in Collatz(2*n+1) if is_odd(x)] for n in [0..15]] for y in sublist] # Tom Edgar, Apr 04 2015
Comments