login
A008876
3x+1 sequence starting at 81.
4
81, 244, 122, 61, 184, 92, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1
OFFSET
0,1
REFERENCES
R. K. Guy, Unsolved Problems in Number Theory, E16.
FORMULA
From Colin Barker, Apr 27 2020: (Start)
G.f.: (81 + 244*x + 122*x^2 - 20*x^3 - 60*x^4 - 30*x^5 - 15*x^6 - 161*x^7 - 22*x^8 - 11*x^9 + 83*x^10 - 17*x^11 + 125*x^12 - 26*x^13 - 13*x^14 - 140*x^15 - 70*x^16 - 35*x^17 - 4*x^18 - 2*x^19 - x^20 - 14*x^21 - 7*x^22) / ((1 - x)*(1 + x + x^2)).
a(n) = a(n-3) for n>22.
(End)
MAPLE
f := proc(n) option remember; if n = 0 then 81; elif f(n-1) mod 2 = 0 then f(n-1)/2 else 3*f(n-1)+1; fi; end;
MATHEMATICA
NestList[If[EvenQ[#], #/2, 3# + 1]&, 81, 100] (* Vincenzo Librandi, Jul 29 2014 *)
PROG
(Haskell)
a008876 n = a008876_list !! n
a008876_list = 81 : iterate a006370 81
-- Reinhard Zumkeller, Aug 30 2012
(Magma) [n eq 1 select 81 else IsOdd(Self(n-1)) select 3*Self(n-1)+1 else Self(n-1) div 2: n in [1..70]]; // Vincenzo Librandi, Jul 29 2014
(Scala) def collatz(n: Int): Int = n % 2 match { case 0 => n / 2; case _ => 3 * n + 1 }
def collatzSeq(n: Int): LazyList[Int] = LazyList.iterate(n)(collatz)
collatzSeq(81).take(100).toList // Alonso del Arte, Apr 24 2020
(PARI) Vec((81 + 244*x + 122*x^2 - 20*x^3 - 60*x^4 - 30*x^5 - 15*x^6 - 161*x^7 - 22*x^8 - 11*x^9 + 83*x^10 - 17*x^11 + 125*x^12 - 26*x^13 - 13*x^14 - 140*x^15 - 70*x^16 - 35*x^17 - 4*x^18 - 2*x^19 - x^20 - 14*x^21 - 7*x^22) / ((1 - x)*(1 + x + x^2)) + O(x^70)) \\ Colin Barker, Apr 27 2020
CROSSREFS
Cf. A006370.
Row 81 of A347270.
Sequence in context: A335843 A255625 A205048 * A031456 A045009 A237167
KEYWORD
nonn,easy
STATUS
approved