|
|
A008894
|
|
3x - 1 sequence starting at 36.
|
|
1
|
|
|
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, 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, 20, 10, 5, 14, 7, 20, 10, 5, 14, 7, 20
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,1
|
|
COMMENTS
|
Previous name was "x -> x/2 if x even, x -> 3x - 1 if x odd."
|
|
REFERENCES
|
R. K. Guy, Unsolved Problems in Number Theory, E16.
|
|
LINKS
|
|
|
FORMULA
|
a(0) = 36, a(n) = a(n - 1)/2 if a(n - 1) is even, otherwise 3a(n - 1) - 1.
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)).
a(n) = a(n - 5) for n > 13.
(End)
|
|
MATHEMATICA
|
-NestList[If[EvenQ[#], #/2, 3# + 1] &, -36, 100] (* Alonso del Arte, Apr 26 2020 *)
|
|
PROG
|
(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(-36).take(100).toList.map(_ * -1) // Alonso del Arte, Apr 26 2020
(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
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|