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.

Previous Showing 11-20 of 60 results. Next

A006884 In the '3x+1' problem, these values for the starting value set new records for highest point of trajectory before reaching 1.

Original entry on oeis.org

1, 2, 3, 7, 15, 27, 255, 447, 639, 703, 1819, 4255, 4591, 9663, 20895, 26623, 31911, 60975, 77671, 113383, 138367, 159487, 270271, 665215, 704511, 1042431, 1212415, 1441407, 1875711, 1988859, 2643183, 2684647, 3041127, 3873535, 4637979, 5656191
Offset: 1

Views

Author

Keywords

Comments

Both the 3x+1 steps and the halving steps are counted.
Where records occur in A025586: A006885(n) = A025586(a(n)) and A025586(m) < A006885(n) for m < a(n). - Reinhard Zumkeller, May 11 2013

References

  • R. B. Banks, Slicing Pizzas, Racing Turtles and Further Adventures in Applied Mathematics, Princeton Univ. Press, 1999. See p. 96.
  • D. R. Hofstadter, Goedel, Escher, Bach: an Eternal Golden Braid, Random House, 1980, p. 400.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

A060409 gives associated "dropping times", A060410 the maximal values and A060411 the steps at which the maxima occur.

Programs

  • Haskell
    a006884 n = a006884_list !! (n-1)
    a006884_list = f 1 0 a025586_list where
       f i r (x:xs) = if x > r then i : f (i + 1) x xs else f (i + 1) r xs
    -- Reinhard Zumkeller, May 11 2013
    
  • Mathematica
    mcoll[n_]:=Max@@NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&]; t={1,max=2}; Do[If[(y=mcoll[n])>max,max=y; AppendTo[t,n]],{n,3,705000,4}]; t (* Jayanta Basu, May 28 2013 *)
    DeleteDuplicates[Parallelize[Table[{n,Max[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&]]},{n,57*10^5}]],GreaterEqual[#1[[2]],#2[[2]]]&][[;;,1]] (* Harvey P. Dale, Apr 23 2023 *)
  • PARI
    A025586(n)=my(r=n); while(n>2, if(n%2, n=3*n+1; if(n>r, r=n)); n>>=1); r
    r=0; for(n=1,1e6, t=A025586(n); if(t>r, r=t; print1(n", "))) \\ Charles R Greathouse IV, May 25 2016

A033496 Numbers m that are the largest number in their Collatz (3x+1) trajectory.

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, 128, 132, 136, 144, 148, 152, 160, 168, 176, 180, 184, 192, 196, 200, 208, 212, 224, 228, 232, 240, 244, 256, 260, 264, 272, 276, 280, 288, 296, 304, 308, 312, 320, 324
Offset: 1

Views

Author

Keywords

Comments

Or, possible peak values in 3x+1 trajectories: 1,2 and m=16k+4,16k+8,16k but not for all k; those 4k numbers [like m=16k+12 and others] which cannot be such peaks are listed in A087252.
Possible values of A025586(m) in increasing order. See A275109 (number of times each value of a(n) occurs in A025586). - Jaroslav Krizek, Jul 17 2016

Examples

			These peak values occur in 1, 3, 6, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 21, 22, 27, 30, 39, 44, 71, 75, 1579 [3x+1]-iteration trajectories started with different initial values. This list most probably is incomplete.
From _Hartmut F. W. Hoft_, Jun 24 2016: (Start)
Let n be the maximum in some Collatz trajectory and let F(n), the initial fan of n, be the set of all initial values less than or equal to n whose Collatz trajectories lead to n as their maximum. Then the size of F(n) never equals 2, 4, 5, 7 or 10 (see the link).
Conjecture: Every number k > 10 occurs as the size of F(n) for some n.
Fans F(n) of size k, for all 10 < k < 355, exist for 4 <= n <= 50,000,000. The largest fan in this range, F(41163712), has size 7450.
(End)
		

Crossrefs

Cf. A095384 (contains a definition of Collatz[]).

Programs

  • Haskell
    a033496 n = a033496_list !! (n-1)
    a033496_list = 1 : filter f [2, 4 ..] where
       f x = x == maximum (takeWhile (/= 1) $ iterate a006370 x)
    -- Reinhard Zumkeller, Oct 22 2015
    
  • Magma
    Set(Sort([Max([k eq 1 select n else IsOdd(Self(k-1)) and not IsOne(Self(k-1)) select 3*Self(k-1)+1 else Self(k-1) div 2: k in [1..5*n]]): n in [1..2^10] | Max([k eq 1 select n else IsOdd(Self(k-1)) and not IsOne(Self(k-1)) select 3*Self(k-1)+1 else Self(k-1) div 2: k in [1..5*n]]) le 2^10])) // Jaroslav Krizek, Jul 17 2016
    
  • Mathematica
    Collatz[a0_Integer, maxits_:1000] := NestWhileList[If[EvenQ[ # ], #/2, 3# + 1] &, a0, Unequal[ #, 1, -1, -10, -34] &, 1, maxits]; (* Collatz[n] function definition by Eric Weisstein *)
    Select[Range[324], Max[Collatz[#]] == # &] (* T. D. Noe, Feb 28 2013 *)
  • Python
    def a(n):
        if n<2: return [1]
        l=[n, ]
        while True:
            if n%2==0: n//=2
            else: n = 3*n + 1
            if n not in l:
                l.append(n)
                if n<2: break
            else: break
        return l
    print([n for n in range(1, 501) if max(a(n)) == n]) # Indranil Ghosh, Apr 14 2017

Formula

A008908(a(n)) = A159999(a(n)). - Reinhard Zumkeller, May 04 2009
Max(A070165(a(n),k): k=1..A008908(a(n))) = A070165(a(n),1) = a(n). - Reinhard Zumkeller, Oct 22 2015

A006885 Record highest point of trajectory before reaching 1 in '3x+1' problem, corresponding to starting values in A006884.

Original entry on oeis.org

1, 2, 16, 52, 160, 9232, 13120, 39364, 41524, 250504, 1276936, 6810136, 8153620, 27114424, 50143264, 106358020, 121012864, 593279152, 1570824736, 2482111348, 2798323360, 17202377752, 24648077896, 52483285312, 56991483520, 90239155648, 139646736808
Offset: 1

Views

Author

Keywords

Comments

Both the 3x+1 steps and the halving steps are counted.
Record values in A025586: a(n) = A025586(A006884(n)) and A025586(m) < a(n) for m < A006884(n). - Reinhard Zumkeller, May 11 2013
In an email of Aug 06 2023, Guy Chouraqui observes that the digital root of a(n) appears to be 7 for all n > 2. - N. J. A. Sloane, Aug 11 2023

References

  • R. B. Banks, Slicing Pizzas, Racing Turtles and Further Adventures in Applied Mathematics, Princeton Univ. Press, 1999. See p. 96.
  • D. R. Hofstadter, Goedel, Escher, Bach: an Eternal Golden Braid, Random House, 1980, p. 400.
  • G. T. Leavens and M. Vermeulen, 3x+1 search problems, Computers and Mathematics with Applications, 24 (1992), 79-99.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a006885 = a025586 . a006884  -- Reinhard Zumkeller, May 11 2013
  • Mathematica
    mcoll[n_]:=Max@@NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>=n&]; t={1,max=2}; Do[If[(y=mcoll[n])>max,AppendTo[t,max=y]],{n,3,10^6,4}]; t (* Jayanta Basu, May 28 2013 *)

A056959 In repeated iterations of function m -> m/2 if m even, m -> 3m+1 if m odd, a(n) is maximum value achieved if starting from n.

Original entry on oeis.org

4, 4, 16, 4, 16, 16, 52, 8, 52, 16, 52, 16, 40, 52, 160, 16, 52, 52, 88, 20, 64, 52, 160, 24, 88, 40, 9232, 52, 88, 160, 9232, 32, 100, 52, 160, 52, 112, 88, 304, 40, 9232, 64, 196, 52, 136, 160, 9232, 48, 148, 88, 232, 52, 160, 9232, 9232, 56, 196, 88, 304, 160, 184
Offset: 1

Views

Author

Henry Bottomley, Jul 18 2000

Keywords

Comments

If a(n) exists (which is the essence of the "3x+1" problem) then a(n) must be a multiple of 4, since if a(n) was odd then the next iteration 3*a(n)+1 would be greater than a(n), while if a(n) was twice an odd number then the next-but-one iteration (3/2)*a(n)+1 would be greater.
The variant A025586 considers the trajectory ending in 1, by definition. Therefore the two sequences differ just at a(1) and a(2). - M. F. Hasler, Oct 20 2019

Examples

			a(6) = 16 since iteration starts: 6, 3, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1, ... and 16 is highest value.
		

Crossrefs

Essentially the same as A025586.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=1, 4,
          max(n, a(`if`(n::even, n/2, 3*n+1))))
        end:
    seq(a(n), n=1..88);  # Alois P. Heinz, Oct 16 2021
  • Mathematica
    a[n_] := Module[{r = n, m = n}, If[n <= 2, 4, While[m > 2, If[OddQ[m], m = 3*m + 1; If[m > r, r = m], m = m/2]]; r]];
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, May 20 2022 *)
  • PARI
    a(n)=my(r=max(4,n));while(n>2,if(n%2,n=3*n+1;if(n>r,r=n),n/=2));r \\ Charles R Greathouse IV, Jul 19 2011

A220237 Triangle read by rows: sorted terms of Collatz trajectories.

Original entry on oeis.org

1, 1, 2, 1, 2, 3, 4, 5, 8, 10, 16, 1, 2, 4, 1, 2, 4, 5, 8, 16, 1, 2, 3, 4, 5, 6, 8, 10, 16, 1, 2, 4, 5, 7, 8, 10, 11, 13, 16, 17, 20, 22, 26, 34, 40, 52, 1, 2, 4, 8, 1, 2, 4, 5, 7, 8, 9, 10, 11, 13, 14, 16, 17, 20, 22, 26, 28, 34, 40, 52, 1, 2, 4, 5, 8, 10, 16
Offset: 1

Views

Author

Reinhard Zumkeller, Jan 03 2013

Keywords

Comments

n-th row = sorted list of {A070165(n,k): k = 1..A006577(n)};
T(n,1) = 1 if Collatz conjecture is true.

Examples

			The table begins:
.   1:  [1]
.   2:  [1,2]
.   3:  [1,2,3,4,5,8,10,16]
.   4:  [1,2,4]
.   5:  [1,2,4,5,8,16]
.   6:  [1,2,3,4,5,6,8,10,16]
.   7:  [1,2,4,5,7,8,10,11,13,16,17,20,22,26,34,40,52]
.   8:  [1,2,4,8]
.   9:  [1,2,4,5,7,8,9,10,11,13,14,16,17,20,22,26,28,34,40,52]
.  10:  [1,2,4,5,8,10,16]
.  11:  [1,2,4,5,8,10,11,13,16,17,20,26,34,40,52]
.  12:  [1,2,3,4,5,6,8,10,12,16] .
		

Crossrefs

Cf. A006577 (row lengths), A025586(right edge), A033493 (row sums).

Programs

  • Haskell
    import Data.List (sort)
    a220237 n k = a220237_tabf !! (n-1) !! (k-1)
    a220237_row n = a220237_tabf !! (n-1)
    a220237_tabf = map sort a070165_tabf
  • Maple
    T:= proc(n) option remember; `if`(n=1, 1,
          sort([n, T(`if`(n::even, n/2, 3*n+1))])[])
        end:
    seq(T(n), n=1..10);  # Alois P. Heinz, Oct 16 2021
  • Mathematica
    Flatten[Table[Sort[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&]],{n,12}]] (* Harvey P. Dale, Jan 28 2013 *)

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

Views

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}
		

Crossrefs

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

A087272 a(n) is the largest prime number in 3x+1 trajectory initiated at n.

Original entry on oeis.org

2, 5, 2, 5, 5, 17, 2, 17, 5, 17, 5, 13, 17, 53, 2, 17, 17, 29, 5, 2, 17, 53, 5, 29, 13, 1619, 17, 29, 53, 1619, 2, 29, 17, 53, 17, 37, 29, 101, 5, 1619, 2, 43, 17, 17, 53, 1619, 5, 37, 29, 29, 13, 53, 1619, 1619, 17, 43, 29, 101, 53, 61, 1619, 1619, 2, 37, 29, 101, 17, 13, 53
Offset: 2

Views

Author

Labos Elemer, Sep 18 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] ofp[x_] := Part[fpl[x], Flatten[Position[PrimeQ[fpl[x]], True]]] Table[Max[ofp[w]], {w, 1, 256}]
    Table[Max[Select[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&],PrimeQ]],{n,2,70}] (* Harvey P. Dale, Feb 27 2023 *)
  • PARI
    a(n) = my (mx=2); while (n>1, if (isprime(n), mx=max(mx,n)); n=if (n%2, 3*n+1, n/2)); mx \\ Rémy Sigrist, Oct 08 2018

Extensions

Offset corrected by Rémy Sigrist, Oct 08 2018

A087232 a(n) is the largest odd term in the 3x+1 trajectory initiated at n.

Original entry on oeis.org

1, 1, 5, 1, 5, 5, 17, 1, 17, 5, 17, 5, 13, 17, 53, 1, 17, 17, 29, 5, 21, 17, 53, 5, 29, 13, 3077, 17, 29, 53, 3077, 1, 33, 17, 53, 17, 37, 29, 101, 5, 3077, 21, 65, 17, 45, 53, 3077, 5, 49, 29, 77, 13, 53, 3077, 3077, 17, 65, 29, 101, 53, 61, 3077, 3077, 1, 65, 33, 101, 17, 69
Offset: 1

Views

Author

Labos Elemer, Sep 18 2003

Keywords

Comments

a(n)=3077 corresponds to peak=9232.

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=1, 1, max(
         `if`(n::odd, n, 0), a(`if`(n::even, n/2, 3*n+1))))
        end:
    seq(a(n), n=1..88);  # Alois P. Heinz, Nov 14 2021
  • 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] ofp[x_] := Part[fpl[x], Flatten[Position[OddQ[fpl[x]], True]]] Table[Max[ofp[w]], {w, 1, 256}]
    (* Second program: *)
    Array[Max@ Select[NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, #, Unequal[#, 1, -1, -10, -34] &, 1, 10^4], OddQ] &, 69] (* Michael De Vlieger, May 15 2017, after Alonso del Arte at A025586 *)

Formula

If n = 2^k (for integers k >= 0), a(n) = 1; otherwise a(n) = (A025586(n)-1)/3 =(A056959(n)-1)/3. - Paolo Xausa, Nov 13 2021

Extensions

Name simplified by Paolo Xausa, Nov 13 2021

A095381 Initial values for 3x+1 trajectories in which the largest term arising in the iteration is a power of 2.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 21, 32, 42, 64, 85, 128, 151, 170, 201, 227, 256, 302, 341, 402, 454, 512, 604, 682, 804, 908, 1024, 1365, 2048, 2730, 4096, 5461, 8192, 10922, 14563, 16384, 19417, 21845, 29126, 32768, 38834, 43690, 58252, 65536, 87381
Offset: 1

Views

Author

Labos Elemer, Jun 14 2004

Keywords

Comments

Clearly the sequence is infinite and a(n) < 2^n. - Charles R Greathouse IV, May 25 2016

Crossrefs

Programs

  • C
    // Valid below A006884(47) = 12327829503 on 64-bit machines.
    static long is (unsigned long n) {
      unsigned long r = n;
      n >>= __builtin_ctzl(n); // gcc builtin for A007814
      while (n > 1) {
        n = 3*n + 1;
        if (n > r) r = n;
        n >>= __builtin_ctzl(n);
      }
      return !(r & (r-1));
    } // Charles R Greathouse IV, May 25 2016
  • Haskell
    a095381 n = a095381_list !! (n-1)
    a095381_list = map (+ 1) $ elemIndices 1 $ map a209229 a025586_list
    -- Reinhard Zumkeller, Apr 30 2013
    
  • Mathematica
    Coll[n_]:=NestWhileList[If[EvenQ[#],#/2,3*#+1] &,n,#>1&];t={};Do[x = Max[Coll[n]];If[IntegerQ[Log[2,x]],AppendTo[t,n]],{n,90000}];t (* Jayanta Basu, Apr 28 2013 *)
  • PARI
    is(n)=my(r=n); while(n>2, if(n%2, n=3*n+1; if(n>r, r=n)); n>>=1); r>>valuation(r,2)==1 \\ Charles R Greathouse IV, May 25 2016
    

Formula

A025586(a(n)) = 2^j for some j.

A233293 Smallest number that is the largest value in the Collatz (3x + 1) trajectories of exactly n initial values. (a(n)=0 if no such number exists.)

Original entry on oeis.org

3, 1, 0, 40, 0, 0, 16, 0, 88, 592, 0, 628, 52, 160, 304, 1672, 808, 2248, 3616, 11176, 10096, 8728, 4192, 23056, 13912, 65428, 40804, 5812, 9448, 12148, 8584, 82132, 27700, 10528, 91672, 53188, 58804, 20896, 96064, 2752, 32776, 25972, 14560, 183688, 8080
Offset: 0

Views

Author

Jon E. Schoenfield, Dec 06 2013

Keywords

Comments

Smallest number that appears exactly n times in A025586.
Numbers that are not the largest value in the 3x + 1 trajectory of any initial value (that is, numbers that do not appear at all in A025586) are in A213199; the smallest such number is a(0) = 3.
Numbers that are the largest value in the 3x + 1 trajectory of exactly one initial value (that is, numbers that appear exactly once in A025586) are in A222562; the smallest such number is a(1) = 1.
Numbers that are the largest value in the 3x + 1 trajectories of exactly three initial values (that is, numbers that appear exactly three times in A025586) are in A232870; the smallest such number is a(3) = 40.
No number that is the largest value in the 3x + 1 trajectories of exactly 2, 4, 5, 7, or 10 initial values exists, so a(n) = 0 at n = 2, 4, 5, 7, and 10; for all other values of n up to 3000, a(n) > 0. Conjecture: a(n) > 0 for all n > 10. - Jon E. Schoenfield, Dec 14 2013

Examples

			a(0) = 3 because no 3x + 1 trajectories have 3 as their largest value, and 3 is the smallest number for which this is the case.
a(1) = 1 because exactly one 3x + 1 trajectory (namely, the one whose initial value is 1) has 1 as its largest value (and 1 is the smallest number for which this is the case).
a(3) = 40 because exactly three 3x + 1 trajectories (the ones whose initial values are 13, 26, and 40) have 40 as their largest value, and 40 is the smallest number for which this is the case.
a(2) = 0 because there exists no number that is the largest value in exactly two 3x + 1 trajectories.
		

Crossrefs

Programs

Previous Showing 11-20 of 60 results. Next