cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A070168 Irregular triangle of Terras-modified Collatz problem.

This page as a plain text file.
%I A070168 #37 Feb 16 2025 08:32:46
%S A070168 1,2,1,3,5,8,4,2,1,4,2,1,5,8,4,2,1,6,3,5,8,4,2,1,7,11,17,26,13,20,10,
%T A070168 5,8,4,2,1,8,4,2,1,9,14,7,11,17,26,13,20,10,5,8,4,2,1,10,5,8,4,2,1,11,
%U A070168 17,26,13,20,10,5,8,4,2,1,12,6,3,5,8,4,2,1,13,20,10,5,8,4,2,1,14,7,11
%N A070168 Irregular triangle of Terras-modified Collatz problem.
%C A070168 The row length of this irregular triangle is A006666(n) + 1 = A064433(n+1), n >= 1. - _Wolfdieter Lang_, Mar 20 2014
%H A070168 Reinhard Zumkeller, <a href="/A070168/b070168.txt">Rows n = 1..250 of triangle, flattened</a>
%H A070168 J. C. Lagarias, <a href="http://www.jstor.org/stable/2322189">The 3x+1 Problem and its Generalizations</a>, Amer. Math. Monthly 92 (1985) 3-23.
%H A070168 R. Terras, <a href="http://matwbn.icm.edu.pl/ksiazki/aa/aa30/aa3034.pdf">A stopping time problem on the positive integers</a>, Acta Arith. 30 (1976) 241-252.
%H A070168 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/CollatzProblem.html">Collatz Problem</a>
%H A070168 Wikipedia, <a href="http://en.wikipedia.org/wiki/Collatz_conjecture">Collatz conjecture</a>
%F A070168 From _Wolfdieter Lang_, Mar 20 2014: (Start)
%F A070168 See Lagarias, pp. 4-7, eqs. (2.1), (2.4) with (2.5) and (2.6).
%F A070168 T(n,k) = T^{(k)}(n), with the iterations of the Terras-modified Collatz map: T(n) = n/2 if n is even and otherwise (3*n+1)/2, n >= 1. T^{(0)}(n) = n.
%F A070168 T(n,k) = lambda(n,k)*n + rho(n,k), with lambda(n,k) = (3^X(n,k,-1))/2^k and rho(n,k) = sum(x(n,j)*(3^X(n,k,j))/ 2^(k-j), j=0..(k-1)) with X(n,k,j) = sum(x(n,j+p), p=1.. (k-1-j)) where x(n,j) = T^{(j)}(n) (mod 2). The parity sequence suffices to determine T(n,k).
%F A070168 (End)
%e A070168 The irregular triangle begins:
%e A070168 n\k   0   1   2   3   4   5   6   8  9 10  11  12  13  14 ...
%e A070168 1:    1
%e A070168 2:    2   1
%e A070168 3:    3   5   8   4   2   1
%e A070168 4:    4   2   1
%e A070168 5:    5   8   4   2   1
%e A070168 6:    6   3   5   8   4   2   1
%e A070168 7:    7  11  17  26  13  20  10   5  8  4   2   1
%e A070168 8:    8   4   2   1
%e A070168 9:    9  14   7  11  17  26  13  20 10  5   8   4   2   1
%e A070168 10:  10   5   8   4   2   1
%e A070168 11:  11  17  26  13  20  10   5   8  4  2   1
%e A070168 12:  12   6   3   5   8   4   2   1
%e A070168 13:  13  20  10   5   8   4   2   1
%e A070168 14:  14   7  11  17  26  13  20  10  5  8   4   2   1
%e A070168 15:  15  23  35  53  80  40  20  10  5  8   4   2   1
%e A070168 ...  formatted by _Wolfdieter Lang_, Mar 20 2014
%e A070168 -------------------------------------------------------------
%t A070168 f[n_] := If[EvenQ[n], n/2, (3 n + 1)/2];
%t A070168 Table[NestWhileList[f, n, # != 1 &], {n, 1, 30}] // Grid (* _Geoffrey Critzer_, Oct 18 2014 *)
%o A070168 (Haskell)
%o A070168 a070168 n k = a070168_tabf !! (n-1) !! (k-1)
%o A070168 a070168_tabf = map a070168_row [1..]
%o A070168 a070168_row n = (takeWhile (/= 1) $ iterate a014682 n) ++ [1]
%o A070168 a070168_list = concat a070168_tabf
%o A070168 -- _Reinhard Zumkeller_, Oct 03 2014
%o A070168 (Python)
%o A070168 def a(n):
%o A070168     if n==1: return [1]
%o A070168     l=[n, ]
%o A070168     while True:
%o A070168         if n%2==0: n//=2
%o A070168         else: n = (3*n + 1)//2
%o A070168         l.append(n)
%o A070168         if n<2: break
%o A070168     return l
%o A070168 for n in range(1, 16): print(a(n)) # _Indranil Ghosh_, Apr 15 2017
%Y A070168 Cf. A070165 (ordinary Collatz case).
%Y A070168 Cf. A014682, A248573, A285098 (row sums).
%K A070168 nonn,easy,tabf
%O A070168 1,2
%A A070168 _Eric W. Weisstein_, Apr 23 2002
%E A070168 Name shortened, tabl changed into tabf, Cf. added by _Wolfdieter Lang_, Mar 20 2014