|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,1
|
|
REFERENCES
|
R. K. Guy, Unsolved Problems in Number Theory, E16.
|
|
LINKS
|
|
|
FORMULA
|
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
|
|
|
PROG
|
(Haskell)
a008876 n = a008876_list !! n
a008876_list = 81 : iterate a006370 81
(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)
(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
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|