Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #17 Apr 26 2020 17:48:32
%S 36,18,9,26,13,38,19,56,28,14,7,20,10,5,14,7,20,10,5,14,7,20,10,5,14,
%T 7,20,10,5,14,7,20,10,5,14,7,20,10,5,14,7,20,10,5,14,7,20,10,5,14,7,
%U 20,10,5,14,7,20,10,5,14,7,20
%N 3x - 1 sequence starting at 36.
%C Previous name was "x -> x/2 if x even, x -> 3x - 1 if x odd."
%D R. K. Guy, Unsolved Problems in Number Theory, E16.
%H Colin Barker, <a href="/A008894/b008894.txt">Table of n, a(n) for n = 0..1000</a>
%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,0,1).
%F a(0) = 36, a(n) = a(n - 1)/2 if a(n - 1) is even, otherwise 3a(n - 1) - 1.
%F From _Colin Barker_, Apr 26 2020: (Start)
%F G.f.: (36 + 18*x + 9*x^2 + 26*x^3 + 13*x^4 + 2*x^5 + x^6 + 47*x^7 + 2*x^8 + x^9 - 31*x^10 + x^11 - 46*x^12 - 23*x^13) / ((1 - x)*(1 + x + x^2 + x^3 + x^4)).
%F a(n) = a(n - 5) for n > 13.
%F (End)
%t -NestList[If[EvenQ[#], #/2, 3# + 1] &, -36, 100] (* _Alonso del Arte_, Apr 26 2020 *)
%o (Scala) def collatz(n: Int): Int = n % 2 match {
%o case 0 => n / 2
%o case _ => 3 * n + 1
%o }
%o def collatzSeq(n: Int): LazyList[Int] = LazyList.iterate(n)(collatz)
%o collatzSeq(-36).take(100).toList.map(_ * -1) // _Alonso del Arte_, Apr 26 2020
%o (PARI) Vec((36 + 18*x + 9*x^2 + 26*x^3 + 13*x^4 + 2*x^5 + x^6 + 47*x^7 + 2*x^8 + x^9 - 31*x^10 + x^11 - 46*x^12 - 23*x^13) / ((1 - x)*(1 + x + x^2 + x^3 + x^4)) + O(x^70)) \\ _Colin Barker_, Apr 26 2020
%K nonn,easy
%O 0,1
%A _N. J. A. Sloane_.
%E More specific name from _Alonso del Arte_, Apr 26 2020