cp's OEIS Frontend

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.

Showing 1-10 of 16 results. Next

A087257 Duplicate of A033496.

Original entry on oeis.org

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

Views

Author

Keywords

A008908 a(n) = (1 + number of halving and tripling steps to reach 1 in the Collatz (3x+1) problem), or -1 if 1 is never reached.

Original entry on oeis.org

1, 2, 8, 3, 6, 9, 17, 4, 20, 7, 15, 10, 10, 18, 18, 5, 13, 21, 21, 8, 8, 16, 16, 11, 24, 11, 112, 19, 19, 19, 107, 6, 27, 14, 14, 22, 22, 22, 35, 9, 110, 9, 30, 17, 17, 17, 105, 12, 25, 25, 25, 12, 12, 113, 113, 20, 33, 20, 33, 20, 20, 108, 108, 7, 28, 28, 28, 15, 15, 15, 103
Offset: 1

Views

Author

Keywords

Comments

The number of steps (iterations of the map A006370) to reach 1 is given by A006577, this sequence counts 1 more. - M. F. Hasler, Nov 05 2017
When Collatz 3N+1 function is seen as an isometry over the dyadics, the halving step necessarily following each tripling is not counted, hence N -> N/2, if even, but N -> (3N+1)/2, if odd. Counting iterations of this map until reaching 1 leads to sequence A064433. - Michael Vielhaber (vielhaber(AT)gmail.com), Nov 18 2009

References

  • R. K. Guy, Unsolved Problems in Number Theory, E16.

Crossrefs

Programs

  • Haskell
    a008908 = length . a070165_row
    -- Reinhard Zumkeller, May 11 2013, Aug 30 2012, Jul 19 2011
    
  • Maple
    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
  • Mathematica
    Table[Length[NestWhileList[If[EvenQ[ # ], #/2, 3 # + 1] &, i, # != 1 &]], {i, 75}]
  • PARI
    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
    
  • Python
    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

Formula

a(n) = A006577(n) + 1.
a(n) = f(n,1) with f(n,x) = if n=1 then x else f(A006370(n),x+1).
a(A033496(n)) = A159999(A033496(n)). - Reinhard Zumkeller, May 04 2009
a(n) = A006666(n) + A078719(n).
a(n) = length of n-th row in A070165. - Reinhard Zumkeller, May 11 2013

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Apr 27 2001
"Escape clause" added to definition by N. J. A. Sloane, Jun 06 2017
Edited by M. F. Hasler, Nov 05 2017

A159999 Number of numbers not greater than n occurring in Collatz (3x+1) trajectory starting with n.

Original entry on oeis.org

1, 2, 3, 3, 4, 6, 5, 4, 7, 6, 7, 9, 7, 10, 7, 5, 9, 14, 11, 8, 6, 12, 9, 11, 14, 10, 10, 16, 14, 11, 10, 6, 17, 12, 9, 20, 18, 17, 18, 9, 13, 8, 20, 16, 14, 12, 13, 12, 20, 21, 18, 12, 10, 18, 15, 20, 24, 19, 22, 16, 14, 17, 15, 7, 23, 25, 22, 15, 13, 12, 16, 23
Offset: 1

Views

Author

Reinhard Zumkeller, May 04 2009

Keywords

Comments

If the Collatz conjecture is true, there are no cycles in the 3x+1 trajectory and the difference between the counts here and those of A076228 is that the start value is counted here but not there; then a(n) = 1+A076228(n) [discovered by sequencedb.net]. - R. J. Mathar, Jun 24 2021

Examples

			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]*.
		

Crossrefs

Programs

  • Haskell
    a159999 n = length $ takeWhile (<= n) $ sort $ a070165_row n
    -- Reinhard Zumkeller, Sep 01 2012
  • Mathematica
    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 *)

Formula

a(n) < n for n>6;
a(A033496(n)) = A008908(A033496(n)).
a(n) = f(n,n,1) with f(n,m,x) = if m=1 then x else f(n, A006370(m), if A006370(m)
a(n) = n - A246436(n); row lengths of triangle A214614. - Reinhard Zumkeller, Sep 01 2014

A087256 Number of different initial values for 3x+1 trajectories in which the largest term appearing in the iteration is 2^n.

Original entry on oeis.org

1, 1, 1, 6, 1, 3, 1, 3, 1, 12, 1, 3, 1, 3, 1, 8, 1, 3, 1, 3, 1, 6, 1, 3, 1, 3, 1, 13, 1, 3, 1, 3, 1, 8, 1, 3, 1, 3, 1, 6, 1, 3, 1, 3, 1, 9, 1, 3, 1, 3, 1, 11, 1, 3, 1, 3, 1, 6, 1, 3, 1, 3, 1, 21, 1, 3, 1, 3, 1, 8, 1, 3, 1, 3, 1, 6, 1, 3, 1, 3, 1, 78, 1, 3, 1, 3, 1, 8, 1, 3, 1, 3, 1, 6, 1, 3, 1, 3, 1, 9, 1, 3, 1
Offset: 1

Author

Labos Elemer, Sep 08 2003

Keywords

Comments

It would be interesting to know whether the ...1,3,1,3,1,x,1,3,1,3,1,... pattern persists. - John W. Layman, Jun 09 2004
The observed pattern should persist. Proof: [1] a(odd)=1 because -1+2^odd is not divisible by 3, so in Collatz-algorithm 2^odd is preceded by increasing inverse step. Thus 2^odd is the only suitable initial value; [2] a[2k]>=3 for k>1 because 2^(2k)-1=-1+4^k=3A so {b=2^2k, (b-1)/3 and (2a-2)/3} are three relevant initial values. No more case arises unless condition-[3] (see below) was satisfied; [3] a[6k+4]>=5 for k>=1, ..iv=c=2^(6k+4); here {c, (c-1)/3, 2(c-1)/3, (2c-5)/9, (4c-10)/9} is 5 suitable initial values, iff (2c-5)/9 is an integer; e.g. at 6k+4=10, {1024<-341<-682<-227<-454} back-tracking the iteration. - Labos Elemer, Jun 17 2004
From Hartmut F. W. Hoft, Jun 24 2016: (Start)
Except for a(2)=1 the sequence has the 6-element quasiperiod 1, 3, 1, x, 1, 3 where x>=6, but unequal to 7 and 10 (see links below and in A033496). Observe that for n=2^(6k+4)=16*2^(6k), n mod 9 = 7 so that (2n-5)/9 is an integer and a(n)>=6.
Conjecture: All numbers m > 10 occur as values in A087256 (see A233293).
The conjecture has been verified for all 10 < k < 133 for Collatz trajectories with maximum value through 2^(36000*6 + 4). The largest fan of initial values in this range, F(6*1993+4), has maximum 2^11962 and size 3958.
(End)

Examples

			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}
		

Programs

  • Mathematica
    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}]
  • PARI
    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

Formula

a(6n+4) = A105730(n). - David Wasserman, Apr 18 2005

Extensions

Terms a(19)-a(21) from John W. Layman, Jun 09 2004
More terms from David Wasserman, Apr 18 2005

A222562 Numbers that are highest in their respective Collatz (3x+1) trajectories only.

Original entry on oeis.org

1, 2, 4, 8, 20, 24, 32, 48, 56, 68, 72, 80, 84, 96, 104, 116, 128, 132, 144, 152, 168, 176, 180, 192, 200, 212, 224, 228, 240, 260, 264, 272, 276, 288, 296, 308, 312, 320, 324, 336, 344, 356, 360, 368, 372, 384, 392, 404, 408, 416, 452, 456, 464, 468, 480, 488
Offset: 1

Author

Jayanta Basu, Feb 27 2013

Keywords

Comments

This is effectively the complement of A176869 in A033496, excluding numbers which are also highest in trajectories less than the number itself.

Crossrefs

Programs

  • Mathematica
    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 *)

A105730 Number of different initial values for 3x+1 trajectories in which the largest term appearing in the iteration is 2^(6n+4).

Original entry on oeis.org

6, 12, 8, 6, 13, 8, 6, 9, 11, 6, 21, 8, 6, 78, 8, 6, 9, 13, 6, 15, 8, 6, 16, 8, 6, 9, 20, 6, 12, 8, 6, 13, 8, 6, 9, 11, 6, 14, 8, 6, 32, 8, 6, 9, 32, 6, 23, 8, 6, 24, 8, 6, 9, 14, 6, 12, 8, 6, 13, 8, 6, 9, 11, 6, 14, 8, 6, 19, 8, 6, 9, 13, 6, 80, 8, 6, 29, 8, 6, 9, 18, 6, 12, 8, 6, 13, 8, 6, 9, 11
Offset: 0

Author

David Wasserman, Apr 18 2005

Keywords

Comments

From Hartmut F. W. Hoft, Jun 24 2016: (Start)
The sequence has the quasiperiod 6, x, 8, 6, y, 8, 6, 9, z of length 9 starting at index 0 where x, y, z > 10; in addition, a(3*9*n+1) = 12, a(3*9*n+4) = 13 and a(3*9*n+8) = 11 for all n>=0; proof by induction (see this link) as in the link in A087256 based on the modular identities in the link in A033496.
Conjecture: All numbers greater than 10 appear in the sequence (see also A033496 and A233293). (End)

Examples

			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
		

Crossrefs

Programs

  • Mathematica
    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 *)

Formula

a(n) = A087256(6n+4).

A176869 Numbers that are the maximum value attained by the Collatz (3x+1) iteration of some odd number.

Original entry on oeis.org

1, 16, 40, 52, 64, 88, 100, 112, 136, 148, 160, 184, 196, 208, 232, 244, 256, 280, 304, 340, 352, 400, 424, 448, 472, 520, 532, 544, 592, 616, 628, 640, 688, 712, 724, 736, 784, 808, 820, 832, 868, 904, 916, 928, 952, 964, 976, 1024, 1048, 1072, 1108, 1120
Offset: 1

Author

T. D. Noe, Apr 27 2010

Keywords

Comments

Here the 3x+1 steps and the halving steps are applied separately. We use odd numbers because then the Collatz iteration always increases to a maximum value before (hopefully) going to 1. This is a subsequence of A033496. Except for the first term, all these numbers appear to equal 4 (mod 12). Some terms are the maximum value for the Collatz iteration of many numbers. For example, 9232 is the maximum value of the Collatz iteration of 408 odd numbers, the smallest of which is 27.

Crossrefs

Cf. A025586 (maximum value in the Collatz iteration of n)

A213199 Numbers k whose Collatz (3x+1) trajectory includes at least one term that is greater than k.

Original entry on oeis.org

3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63, 65, 66, 67, 69, 70, 71, 73, 74, 75, 76, 77, 78, 79, 81, 82, 83
Offset: 1

Author

Jayanta Basu, Mar 01 2013

Keywords

Examples

			a(1) = 3 because 3 is the first number k whose trajectory goes above k.
		

Crossrefs

Programs

  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; Select[Range[100], Max[Collatz[#]] > # &] (* T. D. Noe, Mar 01 2013 *)

A222597 Number of terms of the Collatz (3x+1) trajectory of n that are greater than n.

Original entry on oeis.org

0, 0, 5, 0, 2, 3, 12, 0, 13, 1, 8, 1, 3, 8, 11, 0, 4, 7, 10, 0, 2, 4, 7, 0, 10, 1, 102, 3, 5, 8, 97, 0, 10, 2, 5, 2, 4, 5, 17, 0, 97, 1, 10, 1, 3, 5, 92, 0, 5, 4, 7, 0, 2, 95, 98, 0, 9, 1, 11, 4, 6, 91, 93, 0, 5, 3, 6, 0, 2, 3, 87, 0, 97, 1, 7, 1, 3, 10, 13, 0, 6
Offset: 1

Author

T. D. Noe, Mar 01 2013

Keywords

Crossrefs

Cf. A033496, A213199 (location of zero and nonzero terms).

Programs

  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; Table[Length[Select[Collatz[n], # > n &]], {n, 100}]
  • PARI
    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

A087260 a(n) = gcd(4n, A025586(4n)), greatest common divisor of 4n and largest value in 3x+1 iteration list started at 4n.

Original entry on oeis.org

4, 8, 4, 16, 20, 24, 4, 32, 4, 40, 4, 48, 52, 56, 20, 64, 68, 72, 4, 80, 84, 88, 4, 96, 100, 104, 4, 112, 116, 40, 4, 128, 132, 136, 20, 144, 148, 152, 4, 160, 4, 168, 4, 176, 180, 184, 4, 192, 196, 200, 4, 208, 212, 8, 4, 224, 228, 232, 4, 240, 244, 8, 4, 256, 260, 264
Offset: 1

Author

Labos Elemer, Sep 09 2003

Keywords

Crossrefs

Programs

  • Mathematica
    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}]
Showing 1-10 of 16 results. Next