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 53 results. Next

A302175 a(n) = [2^A006666(n)/3^A006667(n)], where [x] = floor(x).

Original entry on oeis.org

1, 2, 3, 4, 5, 7, 8, 8, 11, 10, 12, 14, 14, 16, 16, 16, 18, 22, 22, 21, 21, 25, 25, 28, 29, 28, 32, 33, 33, 33, 36, 32, 39, 37, 37, 44, 44, 44, 47, 42, 48, 42, 53, 50, 50, 50, 54, 56, 59, 59, 59, 56, 56, 64, 64, 67, 71, 67, 71, 67, 67, 72, 72, 64, 79, 79, 79, 75
Offset: 1

Views

Author

Michel Lagneau, Apr 03 2018

Keywords

Comments

The sequence contains A211981 and the powers of 2 (A000079).
There exists a subset E = { 1, 2, 3, 4, 5, 8, 10, 16, 21, 32, 42, 64, 85, 128, 170, 227, 256, 341, 512, 682, 1024, 2048, ...} in {a(n)} such that each element m of E generates the Collatz sequence of iterates m -> T_1(m) -> T_2(m) -> T_3(m) -> ... -> 1 where any T_i(m) is an element of E of the form [2^i /3^j] where i = A006666(m), or A006666(m)-1, or ... and j = A006667(m), or A006667(m)-1, or ..., but with A006667(m) <= 3. If m is even then m/2 is in E.
For example, the statement that "3 is an element of E" implies that each element of the trajectory 3 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1 belongs to E. Thus the trajectory of the number 3 can be represented by [2^5/3^2] -> [2^5/3^1] -> [2^4/3^1] -> [2^4/3^0] -> [2^3/3^0] -> [2^2/3^0] -> [2^1/3^0] -> [2^0/3^0].

Examples

			a(39) = [2^A006666(39)/3^A006667(39)] = [2^23/3^11] = [47.353937...] = 47.
		

Crossrefs

Programs

  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; nn = 70; t = {}; n = 0; While[Length[t] < nn, n++; c = Collatz[n]; ev = Length[Select[c, EvenQ]]; od = Length[c] - ev - 1; AppendTo[t, Floor[2^ev/3^od]]]; t
  • PARI
    a(n) = my(t, h); while(n>1, if(n%2, n=3*n+1; t++, n>>=1; h++)); 2^h\3^t; \\ Michel Marcus, May 05 2018

A303811 Least k such that A006666(k)/A006667(k) = prime(n).

Original entry on oeis.org

159, 6, 10, 40, 640, 2560, 40960, 163840, 2621440, 167772160, 671088640, 42949672960, 687194767360, 2748779069440, 43980465111040, 2814749767106560, 180143985094819840, 720575940379279360, 46116860184273879040, 737869762948382064640, 2951479051793528258560
Offset: 1

Views

Author

Michel Lagneau, Sep 10 2018

Keywords

Comments

A006666 and A006667 are respectively the number of halving and tripling steps in the '3x+1' problem.
For n > 2, it seems that a(n) is of the form a(n) = 5*2^q with q = 1, 3, 7, 9, 13, 15, 19, 25, 27, 33, 37, 39, 43, 49, 55, 57, 63, 67, 69, ... (Numbers q such that q+4 is prime: A172367)

Examples

			a(4) = 40 because A006666(40)/A006667(40) = 7/1 = prime(4).
		

Crossrefs

Programs

  • Maple
    nn:=10^20:
    for n from 1 to 10 do:
    ii:=0:
       for k from 1 to nn while(ii=0) do:
        it0:=0:it1:=0:m:=k:
          for i from 1 to nn while(m<>1) do:
            if irem(m, 2)=0
             then
             m:=m/2:it0:=it0+1:
             else
             m:=3*m+1:it1:=it1+1:
           fi:
         od:
          if it1<>0 and it0/it1 = ithprime(n)
           then
           ii:=1:printf(`%d %d \n`,n,k):
           else
         fi:
    od:
    od:

A304123 Denominators of records low values of the ratio n*3^A006667(n)/2^A006666(n).

Original entry on oeis.org

1, 32, 2048, 8192, 2199023255552, 144115188075855872, 576460752303423488, 2305843009213693952
Offset: 1

Views

Author

Michel Lagneau, May 06 2018

Keywords

Examples

			For n=1 to 10 the ratios are 1, 1, 27/32, 1, 15/16, 27/32, 1701/2048, 1, 6561/8192, 15/16, so the low records are 1, 27/32, 1701/2048, 6561/8192, ...
		

Crossrefs

Cf. A127789 (for the indices where these records occur).
Cf. A304119 (for the corresponding numerators).

Programs

  • Mathematica
    q=1;Collatz[n_]:=NestWhileList[If[EvenQ[#],#/2,3 #+1]&,n,#>1&];nn=5000;t={};n=0;While[Length[t]
    				
  • PARI
    ht(n) = my(h, t); while(n>1, if(n%2, n=3*n+1; t++, n>>=1; h++)); return([h, t]);
    lista(nn) = {m = 2; for (n=1, nn, v = ht(n); newm = n*3^v[2]/2^v[1]; if (newm < m, print1(denominator(newm), ", "); m = newm)); } \\ Michel Marcus, May 06 2018

A304524 Consider the ratio res(p) = 2^A006666(p) / (p*3^A006667(p)) where p is prime. The prime numbers in this sequence are those for which res(p) sets a new record.

Original entry on oeis.org

2, 3, 7, 37, 43, 229, 271, 379, 673, 839, 1987, 5297, 25111, 44641, 50221, 94057, 334423, 1189057, 1759579, 2505337, 28153249, 46869157, 87780541, 584543567, 768901097
Offset: 1

Views

Author

Michel Lagneau, May 14 2018

Keywords

Comments

Is the sequence finite?
In the general case, the residue of a number n in the 3x+1 problem is defined as the ratio res(n) = 2^A006666(n) / (n*3^A006667(n)) (see A127789).
Conjecture: for all prime p, res(p) < res(993) = 2^61/(3^32*993) = 1.253142... (see A304174).

Examples

			From _Jon E. Schoenfield_, May 23 2018: (Start)
Let D = A006666(p) and U = A006667(p); then res(p) = 2^D/(p*3^U). It seems clear that res(993) - res(p) is converging toward a positive value:
.
          p |   D |  U |     res(p)      | res(993)-res(p)
  ----------+-----+----+-----------------+----------------
          2 |   1 |  0 | 1               | 0.2531421443...
          3 |   5 |  2 | 1.1851851851... | 0.0679569592...
          7 |  11 |  5 | 1.2039976484... | 0.0491444959...
         37 |  15 |  6 | 1.2148444741... | 0.0382976702...
         43 |  20 |  9 | 1.2389111604... | 0.0142309838...
        229 |  24 | 10 | 1.2407145246... | 0.0124276197...
        271 |  29 | 13 | 1.2425797507... | 0.0105623936...
        379 |  39 | 19 | 1.2480350469... | 0.0051070974...
        673 |  43 | 21 | 1.2494773856... | 0.0036647587...
        839 |  56 | 29 | 1.2514151532... | 0.0017269911...
       1987 |  62 | 32 | 1.2525114739... | 0.0006306704...
       5297 |  65 | 33 | 1.2529055685... | 0.0002365758...
      25111 |  72 | 36 | 1.2529406796... | 0.0002014647...
      44641 |  76 | 38 | 1.2529625095... | 0.0001796348...
      50221 |  73 | 36 | 1.2529656281... | 0.0001765162...
      94057 |  85 | 43 | 1.2529812032... | 0.0001609411...
     334423 |  90 | 45 | 1.2529882803... | 0.0001538640...
    1189057 |  95 | 47 | 1.2529909733... | 0.0001511710...
    1759579 | 113 | 58 | 1.2529910420... | 0.0001511023...
    2505337 | 104 | 52 | 1.2529915763... | 0.0001505680...
   28153249 | 117 | 58 | 1.2529917096... | 0.0001504347...
   46869157 | 132 | 67 | 1.2529917720... | 0.0001503722...
   87780541 | 144 | 74 | 1.2529919281... | 0.0001502162...
  584543567 | 161 | 83 | 1.2529919325... | 0.0001502118...
  768901097 | 182 | 96 | 1.2529919396... | 0.0001502047...
(End)
		

Crossrefs

Programs

  • Mathematica
    lst={2};Print["a(n)"," ","A006667(a(n))"," ","A006666(a(n))","       ","res(a(n))"];q=1;Collatz[n_]:=NestWhileList[If[EvenQ[#],#/2,3 #+1]&,Prime[n],#>1&];nn=10000;t={};n=0;While[Length[t]5000,Break[]];q=Prime[n]*3^od/2^ev]];lst

Extensions

a(23)-a(24) from Jon E. Schoenfield, May 19 2018

A318907 Numbers m such that A006666(m)/A006667(m) is an integer.

Original entry on oeis.org

5, 6, 10, 17, 20, 21, 24, 26, 40, 42, 44, 45, 46, 80, 84, 85, 96, 104, 106, 112, 113, 116, 117, 120, 122, 136, 138, 140, 141, 150, 151, 159, 160, 168, 170, 283, 288, 296, 298, 304, 308, 309, 320, 321, 324, 325, 326, 331, 336, 340, 341, 377, 384, 416, 424, 426
Offset: 1

Views

Author

Michel Lagneau, Sep 06 2018

Keywords

Comments

A006666 and A006667 are respectively the number of halving and tripling steps in the '3x+1' problem.
The corresponding integers are 4, 3, 5, 3, 6, 6, 4, 4, 7, 7, 3, 3, 3, 8, 8, 8, 5, 5, 5, 3, 5, 3, 3, 3, ...
The numbers of the form (4^k - 1)/3 for k > 1 (A002450) are in the sequence.
We observe subsets of consecutive numbers: (5, 6), (20, 21), (44, 45, 46), (84, 85), (112, 113), ...

Examples

			17 is in the sequence because A006666(17)/A006667(17) = 9/3 = 3 is an integer.
		

Crossrefs

Programs

  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; nn = 70; t = {}; n = 0; While[Length[t] < nn, n++; c = Collatz[n]; ev = Length[Select[c, EvenQ]]; od = Length[c] - ev - 1; If[od>0 && IntegerQ[ev/od],AppendTo[t, n]]]; t

A006577 Number of halving and tripling steps to reach 1 in '3x+1' problem, or -1 if 1 is never reached.

Original entry on oeis.org

0, 1, 7, 2, 5, 8, 16, 3, 19, 6, 14, 9, 9, 17, 17, 4, 12, 20, 20, 7, 7, 15, 15, 10, 23, 10, 111, 18, 18, 18, 106, 5, 26, 13, 13, 21, 21, 21, 34, 8, 109, 8, 29, 16, 16, 16, 104, 11, 24, 24, 24, 11, 11, 112, 112, 19, 32, 19, 32, 19, 19, 107, 107, 6, 27, 27, 27, 14, 14, 14, 102, 22
Offset: 1

Views

Author

Keywords

Comments

The 3x+1 or Collatz problem is as follows: start with any number n. If n is even, divide it by 2, otherwise multiply it by 3 and add 1. Do we always reach 1? This is a famous unsolved problem. It is conjectured that the answer is yes.
It seems that about half of the terms satisfy a(i) = a(i+1). For example, up to 10000000, 4964705 terms satisfy this condition.
n is an element of row a(n) in triangle A127824. - Reinhard Zumkeller, Oct 03 2012
The number of terms that satisfy a(i) = a(i+1) for i being a power of ten from 10^1 through 10^10 are: 0, 31, 365, 4161, 45022, 477245, 4964705, 51242281, 526051204, 5378743993. - John Mason, Mar 02 2018
5 seems to be the only number whose value matches its total number of steps (checked to n <= 10^9). - Peter Woodward, Feb 15 2021

Examples

			a(5)=5 because the trajectory of 5 is (5,16,8,4,2,1).
		

References

  • R. K. Guy, Unsolved Problems in Number Theory, E16.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

See A070165 for triangle giving trajectories of n = 1, 2, 3, ....

Programs

  • Haskell
    import Data.List (findIndex)
    import Data.Maybe (fromJust)
    a006577 n = fromJust $ findIndex (n `elem`) a127824_tabf
    -- Reinhard Zumkeller, Oct 04 2012, Aug 30 2012
    
  • Maple
    A006577 := proc(n)
            local a,traj ;
            a := 0 ;
            traj := n ;
            while traj > 1 do
                    if type(traj,'even') then
                            traj := traj/2 ;
                    else
                            traj := 3*traj+1 ;
                    end if;
                    a := a+1 ;
            end do:
            return a;
    end proc: # R. J. Mathar, Jul 08 2012
  • Mathematica
    f[n_] := Module[{a=n,k=0}, While[a!=1, k++; If[EvenQ[a], a=a/2, a=a*3+1]]; k]; Table[f[n],{n,4!}] (* Vladimir Joseph Stephan Orlovsky, Jan 08 2011 *)
    Table[Length[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#!=1&]]-1,{n,80}] (* Harvey P. Dale, May 21 2012 *)
  • PARI
    a(n)=if(n<0,0,s=n; c=0; while(s>1,s=if(s%2,3*s+1,s/2); c++); c)
    
  • PARI
    step(n)=if(n%2,3*n+1,n/2);
    A006577(n)=if(n==1,0,A006577(step(n))+1); \\ Michael B. Porter, Jun 05 2010
    
  • Python
    def a(n):
        if n==1: return 0
        x=0
        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, Jun 05 2017
    
  • Python
    def A006577(n):
        ct = 0
        while n != 1: n = A006370(n); ct += 1
        return ct # Ya-Ping Lu, Feb 22 2024
    
  • R
    collatz<-function(n) ifelse(n==1,0,1+ifelse(n%%2==0,collatz(n/2),collatz(3*n+1))); sapply(1:72, collatz) # Christian N. K. Anderson, Oct 09 2024

Formula

a(n) = A006666(n) + A006667(n).
a(n) = A112695(n) + 2 for n > 2. - Reinhard Zumkeller, Apr 18 2008
a(n) = A008908(n) - 1. - L. Edson Jeffery, Jul 21 2014
a(n) = A135282(n) + A208981(n) (after Alonso del Arte's comment in A208981), if 1 is reached, otherwise a(n) = -1. - Omar E. Pol, Apr 10 2022
a(n) = 2*A007814(n + 1) + a(A085062(n)) + 1 for n > 1. - Wing-Yin Tang, Jan 06 2025

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

A006667 Number of tripling steps to reach 1 from n in '3x+1' problem, or -1 if 1 is never reached.

Original entry on oeis.org

0, 0, 2, 0, 1, 2, 5, 0, 6, 1, 4, 2, 2, 5, 5, 0, 3, 6, 6, 1, 1, 4, 4, 2, 7, 2, 41, 5, 5, 5, 39, 0, 8, 3, 3, 6, 6, 6, 11, 1, 40, 1, 9, 4, 4, 4, 38, 2, 7, 7, 7, 2, 2, 41, 41, 5, 10, 5, 10, 5, 5, 39, 39, 0, 8, 8, 8, 3, 3, 3, 37, 6, 42, 6, 3, 6, 6, 11, 11, 1, 6, 40, 40, 1, 1, 9, 9, 4, 9, 4, 33, 4, 4, 38
Offset: 1

Views

Author

Keywords

Comments

A075680, which gives the values for odd n, isolates the essential behavior of this sequence. - T. D. Noe, Jun 01 2006
A033959 and A033958 give record values and where they occur. - Reinhard Zumkeller, Jan 08 2014

References

  • J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 204, Problem 22.
  • R. K. Guy, Unsolved Problems in Number Theory, E16.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Equals A078719(n)-1.

Programs

  • Haskell
    a006667 = length . filter odd . takeWhile (> 2) . (iterate a006370)
    a006667_list = map a006667 [1..]
    -- Reinhard Zumkeller, Oct 08 2011
    
  • Maple
    a:= proc(n) option remember; `if`(n<2, 0,
          `if`(n::even, a(n/2), 1+a(3*n+1)))
        end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Aug 08 2023
  • Mathematica
    Table[Count[Differences[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&]], ?Positive], {n,100}] (* _Harvey P. Dale, Nov 14 2011 *)
  • PARI
    for(n=2,100,s=n; t=0; while(s!=1,if(s%2==0,s=s/2,s=(3*s+1)/2; t++); if(s==1,print1(t,","); ); ))
    
  • Python
    def a(n):
        if n==1: return 0
        x=0
        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 14 2017

Formula

a(1) = 0, a(n) = a(n/2) if n is even, a(n) = a(3n+1)+1 if n>1 is odd. The Collatz conjecture is that this defines a(n) for all n >= 1.
a(n) = A078719(n) - 1; a(A000079(n))=0; a(A062052(n))=1; a(A062053(n))=2; a(A062054(n))=3; a(A062055(n))=4; a(A062056(n))=5; a(A062057(n))=6; a(A062058(n))=7; a(A062059(n))=8; a(A062060(n))=9. - Reinhard Zumkeller, Oct 08 2011
a(n*2^k) = a(n), for all k >= 0. - L. Edson Jeffery, Aug 11 2014
a(n) = floor(log(2^A006666(n)/n)/log(3)). - Joe Slater, Aug 30 2017
a(n) = a(A085062(n)) + A007814(n+1) for n >= 2. - Alan Michael Gómez Calderón, Feb 07 2025
From Alan Michael Gómez Calderón, Mar 31 2025: (Start)
a(n) = a(A139391(n)) + (n mod 2) for n >= 2;
a(n) = a(A139391(A000265(n))) - A209229(n) + 1 for n >= 2;
a(n) = a(A000265(A139391(n))) + (n mod 2) for n >= 2. (End)

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

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

A070168 Irregular triangle of Terras-modified Collatz problem.

Original entry on oeis.org

1, 2, 1, 3, 5, 8, 4, 2, 1, 4, 2, 1, 5, 8, 4, 2, 1, 6, 3, 5, 8, 4, 2, 1, 7, 11, 17, 26, 13, 20, 10, 5, 8, 4, 2, 1, 8, 4, 2, 1, 9, 14, 7, 11, 17, 26, 13, 20, 10, 5, 8, 4, 2, 1, 10, 5, 8, 4, 2, 1, 11, 17, 26, 13, 20, 10, 5, 8, 4, 2, 1, 12, 6, 3, 5, 8, 4, 2, 1, 13, 20, 10, 5, 8, 4, 2, 1, 14, 7, 11
Offset: 1

Views

Author

Eric W. Weisstein, Apr 23 2002

Keywords

Comments

The row length of this irregular triangle is A006666(n) + 1 = A064433(n+1), n >= 1. - Wolfdieter Lang, Mar 20 2014

Examples

			The irregular triangle begins:
n\k   0   1   2   3   4   5   6   8  9 10  11  12  13  14 ...
1:    1
2:    2   1
3:    3   5   8   4   2   1
4:    4   2   1
5:    5   8   4   2   1
6:    6   3   5   8   4   2   1
7:    7  11  17  26  13  20  10   5  8  4   2   1
8:    8   4   2   1
9:    9  14   7  11  17  26  13  20 10  5   8   4   2   1
10:  10   5   8   4   2   1
11:  11  17  26  13  20  10   5   8  4  2   1
12:  12   6   3   5   8   4   2   1
13:  13  20  10   5   8   4   2   1
14:  14   7  11  17  26  13  20  10  5  8   4   2   1
15:  15  23  35  53  80  40  20  10  5  8   4   2   1
...  formatted by _Wolfdieter Lang_, Mar 20 2014
-------------------------------------------------------------
		

Crossrefs

Cf. A070165 (ordinary Collatz case).
Cf. A014682, A248573, A285098 (row sums).

Programs

  • Haskell
    a070168 n k = a070168_tabf !! (n-1) !! (k-1)
    a070168_tabf = map a070168_row [1..]
    a070168_row n = (takeWhile (/= 1) $ iterate a014682 n) ++ [1]
    a070168_list = concat a070168_tabf
    -- Reinhard Zumkeller, Oct 03 2014
    
  • Mathematica
    f[n_] := If[EvenQ[n], n/2, (3 n + 1)/2];
    Table[NestWhileList[f, n, # != 1 &], {n, 1, 30}] // Grid (* Geoffrey Critzer, Oct 18 2014 *)
  • Python
    def a(n):
        if n==1: return [1]
        l=[n, ]
        while True:
            if n%2==0: n//=2
            else: n = (3*n + 1)//2
            l.append(n)
            if n<2: break
        return l
    for n in range(1, 16): print(a(n)) # Indranil Ghosh, Apr 15 2017

Formula

From Wolfdieter Lang, Mar 20 2014: (Start)
See Lagarias, pp. 4-7, eqs. (2.1), (2.4) with (2.5) and (2.6).
T(n,k) = T^{(k)}(n), with the iterations of the Terras-modified Collatz map: T(n) = n/2 if n is even and otherwise (3*n+1)/2, n >= 1. T^{(0)}(n) = n.
T(n,k) = lambda(n,k)*n + rho(n,k), with lambda(n,k) = (3^X(n,k,-1))/2^k and rho(n,k) = sum(x(n,j)*(3^X(n,k,j))/ 2^(k-j), j=0..(k-1)) with X(n,k,j) = sum(x(n,j+p), p=1.. (k-1-j)) where x(n,j) = T^{(j)}(n) (mod 2). The parity sequence suffices to determine T(n,k).
(End)

Extensions

Name shortened, tabl changed into tabf, Cf. added by Wolfdieter Lang, Mar 20 2014

A126241 Dropping times in the 3n+1 problem (or the Collatz problem). Let T(n):=n/2 if n is even, (3n+1)/2 otherwise (A014682). Let a(n) be the smallest integer k such that T^(k)(n)

Original entry on oeis.org

0, 1, 4, 1, 2, 1, 7, 1, 2, 1, 5, 1, 2, 1, 7, 1, 2, 1, 4, 1, 2, 1, 5, 1, 2, 1, 59, 1, 2, 1, 56, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 5, 1, 2, 1, 54, 1, 2, 1, 4, 1, 2, 1, 5, 1, 2, 1, 7, 1, 2, 1, 54, 1, 2, 1, 4, 1, 2, 1, 51, 1, 2, 1, 5, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 5, 1, 2, 1, 45, 1, 2, 1, 8, 1, 2, 1, 4
Offset: 1

Views

Author

Christof Menzel (christof.menzel(AT)hs-niederrhein.de), Mar 08 2007

Keywords

Comments

Also called "stopping times", although that term is usually reserved for A006666.
From K. Spage, Oct 22 2009, corrected Aug 21 2014: (Start)
Congruency relationship: For n>1 and m>1, all m congruent to n mod 2^(a(n)) have a dropping time equal to a(n).
By refining the definition of the dropping time to "starting with x=n, iterate x until (abs(x) <= abs(n))" the above congruency relationship holds for all nonnegative values of n and all positive or negative values of m including zero.
By this refined definition, a(1)=2 rather than the usual zero set by convention. All other values of positive a(n) remain unchanged. (End)
Terras defines a coefficient stopping time (definition 1.5) tau(n) = d which is the smallest d for which 3^u/2^d < 1 where u is the number of tripling steps among the first d steps starting from n. Clearly tau(n) <= a(n), and Terras conjectures (conjecture 2.9) that tau(n) = a(n) for n>=2. - Olivier Rozier, May 13 2024

Examples

			s(15) = 7, since the trajectory {T^(k)(15)} (k=1,2,3,...) equals 23,35,53,80,40,20,10.
		

References

  • J. C. Lagarias, ed., The Ultimate Challenge: The 3x+1 Problem, Amer. Math. Soc., 2010. See p. 33.

Crossrefs

See A074473, which is the main entry for dropping times.
Records: A060412, A060413.
Cf. A020914 (allowable dropping times). - K. Spage, Aug 22 2014

Programs

  • Mathematica
    Collatz2[n_] := If[n<2, {}, Rest[NestWhileList[If[EvenQ[#], #/2, (3 # + 1)/2] &, n, # >= n &]]]; Table[Length[Collatz2[n]], {n, 1, 1000}]

Formula

a(n) = ceiling(A102419(n)/(1+log(2)/log(3))). - K. Spage, Aug 22 2014

Extensions

Broken link fixed by K. Spage, Oct 22 2009
Previous Showing 11-20 of 53 results. Next