A087257 Duplicate of A033496.
1, 2, 4, 8, 16, 20, 24, 32, 40, 48, 52, 56, 64, 68, 72, 80, 84, 88, 96, 100, 104, 112, 116
Offset: 0
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.
a008908 = length . a070165_row -- Reinhard Zumkeller, May 11 2013, Aug 30 2012, Jul 19 2011
a:= proc(n) option remember; 1+`if`(n=1, 0, a(`if`(n::even, n/2, 3*n+1))) end: seq(a(n), n=1..100); # Alois P. Heinz, Jan 29 2021
Table[Length[NestWhileList[If[EvenQ[ # ], #/2, 3 # + 1] &, i, # != 1 &]], {i, 75}]
a(n)=my(c=1); while(n>1, n=if(n%2, 3*n+1, n/2); c++); c \\ Charles R Greathouse IV, May 18 2015
def a(n): if n==1: return 1 x=1 while True: if n%2==0: n//=2 else: n = 3*n + 1 x+=1 if n<2: break return x print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Apr 15 2017
a(9) = #{1,2,4,5,7,8,9} = 7, as 9-28-14-7-22-11-34-17-52-26-13-40-20-10-5-16-8-[4-2-1]* 9-..-..-7-..-..-..-..-..-..-..-..-..-..-5-..-8-[4-2-1]*.
a159999 n = length $ takeWhile (<= n) $ sort $ a070165_row n -- Reinhard Zumkeller, Sep 01 2012
Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; f[n_] := Module[{c = Collatz[n]}, Length[Select[c, # <= n &]]]; Table[ f[n], {n, 100}] (* T. D. Noe, Mar 07 2013 *)
n = 10: 2^10 = 1024 = peak for trajectories started with initial value taken from the list: {151, 201, 227, 302, 341, 402, 454, 604, 682, 804, 908, 1024}; a trajectory with peak=1024: {201, 604, 302, 151, 454, 227, 682, 341, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1}
c[x_]:=c[x]=(1-Mod[x, 2])*(x/2)+Mod[x, 2]*(3*x+1);c[1]=1; fpl[x_]:=FixedPointList[c, x]; {$RecursionLimit=1000;m=0}; Table[Print[{xm-1, m}];m=0; Do[If[Equal[Max[fpl[n]], 2^xm], m=m+1], {n, 1, 2^xm}], {xm, 1, 30}]
f(n, m) = 1 + if(2*n <= m, f(2*n, m), 0) + if (n%6 == 4, f(n\3, m), 0); a(n) = f(2^n, 2^n); \\ David Wasserman, Apr 18 2005
Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; oldMax = {}; t = {}; Do[c = Collatz[n]; If[! MemberQ[oldMax, n] && Max[c] == n, AppendTo[t, n]]; oldMax = Union[oldMax, {Max[c]}], {n, 416}]; t (* T. D. Noe, Feb 28 2013 *)
a(1) = 12, i.e. the number of initial values for 2^10, since 804 -> 402 -> 201 -> 604 -> 302 -> 151 -> 454 -> 227 -> 682 -> 341 -> 1024 and 908 -> (454 -> ... -> 1024) are the two maximal trajectories containing all 12 initial values. a(8) = 11 since 2^(6*8+4) has 11 different initial values for Collatz trajectories leading to it. - _Hartmut F. W. Hoft_, Jun 24 2016
trajectory[start_] := NestWhileList[If[OddQ[#], 3#+1, #/2]&, start, #!=1&] fanSize[max_] := Module[{active={max}, fan={}, current}, While[active!={}, current=First[active];active=Rest[active]; AppendTo[fan, current]; If[2*current<=max, AppendTo[active, 2*current]]; If[Mod[current, 3]==1 && OddQ[(current-1)/3] && current>4, AppendTo[active, (current-1)/3]]]; Length[fan]]/;max==Max[trajectory[max]] a105730[low_, high_] := Map[fanSize[2^(6#+4)]&, Range[low, high]] a105730[0,89] (* Hartmut F. W. Hoft, Jun 24 2016 *)
a(1) = 3 because 3 is the first number k whose trajectory goes above k.
Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; Select[Range[100], Max[Collatz[#]] > # &] (* T. D. Noe, Mar 01 2013 *)
Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; Table[Length[Select[Collatz[n], # > n &]], {n, 100}]
a(n)=my(k=n,s); while(k>1, k=if(k%2,3*k+1,k/2); if(k>n,s++)); s \\ Charles R Greathouse IV, Aug 26 2016
c[x_] := (1-Mod[x, 2])*(x/2)+Mod[x, 2]*(3*x+1)c[1]=1; fpl[x_] := Delete[FixedPointList[c, x], -1] Table[GCD[4*w, Max[fpl[4*w]]], {w, 1, 256}]
Comments