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-8 of 8 results.

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

A177729 Positive integers which do not appear in a Collatz sequence starting from a smaller positive integer.

Original entry on oeis.org

1, 2, 3, 6, 7, 9, 12, 15, 18, 19, 21, 24, 25, 27, 30, 33, 36, 37, 39, 42, 43, 45, 48, 51, 54, 55, 57, 60, 63, 66, 69, 72, 73, 75, 78, 79, 81, 84, 87, 90, 93, 96, 97, 99, 102, 105, 108, 109, 111, 114, 115, 117, 120, 123, 126, 127, 129, 132, 133, 135, 138, 141
Offset: 1

Views

Author

Raul D. Miller, May 12 2010

Keywords

Comments

A variant of A061641, which is the main entry for this sequence.
The inclusion of 2 is apparently due to a non-standard definition of a Collatz sequence; A177729 assumes that the Collatz sequence ends when it reaches 1, whereas the standard definition includes the periodic 1,4,2,... from that point. The inclusion of 0 in A061641 is a bit odd, but is not actually wrong. One usually looks only at positive integers for Collatz sequences. - Franklin T. Adams-Watters, May 14 2010

Examples

			Collatz 1: 1; Collatz 2: 2,1; Collatz 3: 3,10,5,16,8,4,2,1; Collatz 6: 6,3,10,...
		

Crossrefs

Programs

  • Haskell
    a177729 = head . a192719_row  -- Reinhard Zumkeller, Jan 03 2013
  • Mathematica
    coll[n_]:=NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&]; t={1}; Do[If[FreeQ[Union@@Table[coll[i],{i,n-1}],n],AppendTo[t,n]],{n,2,141}]; t (* Jayanta Basu, May 29 2013 *)

Formula

a(n) = A192719(n,1), see also A220263. - Reinhard Zumkeller, Jan 03 2013

A139399 Number of steps to reach a cycle in Collatz problem.

Original entry on oeis.org

0, 0, 5, 0, 3, 6, 14, 1, 17, 4, 12, 7, 7, 15, 15, 2, 10, 18, 18, 5, 5, 13, 13, 8, 21, 8, 109, 16, 16, 16, 104, 3, 24, 11, 11, 19, 19, 19, 32, 6, 107, 6, 27, 14, 14, 14, 102, 9, 22, 22, 22, 9, 9, 110, 110, 17, 30, 17, 30, 17, 17, 105, 105, 4, 25, 25, 25, 12, 12, 12, 100, 20, 113, 20
Offset: 1

Views

Author

Reinhard Zumkeller, Apr 18 2008

Keywords

Comments

a(1)=a(2)=a(4)=0 as A006370(A006370(A006370(x)))=x for x=1,2,4 [corrected by Rémy Sigrist, Jun 28 2020];
a(n) = A006577(n) - 2 for n > 2 (if the conjecture holds).
For n>2: let L = a(n) mod 3, then A006460(n) = if L=0 then 4 else L. - Reinhard Zumkeller, Nov 17 2013

Crossrefs

Essentially the same sequence as A112695.

Programs

  • Haskell
    a139399 = f 0 where
       f k x = if x `elem` [1,2,4] then k else f (k + 1) (a006370 x)
    -- Reinhard Zumkeller, Nov 17 2013
  • Mathematica
    f[n_] := If[EvenQ[n], n/2, 3 n + 1];
    a[n_] := If[n<3, 0, Length[NestWhileList[f, n, {#1, #2, #3} != {4, 2, 1}&, 3]] - 3];
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Aug 08 2022 *)

A238475 Rectangular array with all start numbers Me(n, k), k >= 1, for the Collatz operation ud^(2*n), n >= 1, ending in an odd number, read by antidiagonals.

Original entry on oeis.org

1, 9, 5, 17, 37, 21, 25, 69, 149, 85, 33, 101, 277, 597, 341, 41, 133, 405, 1109, 2389, 1365, 49, 165, 533, 1621, 4437, 9557, 5461, 57, 197, 661, 2133, 6485, 17749, 38229, 21845, 65, 229, 789, 2645, 8533, 25941, 70997, 152917, 87381
Offset: 1

Views

Author

Wolfdieter Lang, Mar 10 2014

Keywords

Comments

The two operations on natural numbers m used in the Collatz 3x+1 conjecture (see the links) are here (following the M. Trümper reference) denoted by u for 'up' and d for 'down': u m = 3*m+1, if m is odd, and d m = m/2 if m is even. The present array gives all positive start numbers Me(n, k), k >= 1, for Collatz sequences following the pattern (word) ud^(2*n), for n >= 1, which end in an odd number. The end number does not depend on n and it is given by Ne(k) = 6*k - 5.
This rectangular array is Example 2.1. with x = 2*n, n >= 1, of the M. Trümper reference, pp. 4-5, written as a triangle by taking NE-SW diagonals. The case x = 2*n+1, n >= 0, for the word ud^(2*k+1) appears as array and triangle in A238476.
The first row sequences of the array Me (they become columns in the triangle Te) are A017077, A238477, A239123, ...
Note that there are also Collatz sequences starting with an odd number, following the pattern ud^(2*n) which end in an even number. For example, take n=1 and the sequence [5, 16, 8, 4]. Such sequences are here not considered.

Examples

			The rectangular array Me(n, k) begins:
n\k      1       2       3        4       5        6        7        8        9       10 ...
1:       1       9      17       25      33       41       49       57       65       73
2:       5      37      69      101     133      165      197      229      261      293
3:      21     149     277      405     533      661      789      917     1045     1173
4:      85     597    1109     1621    2133     2645     3157     3669     4181     4693
5:     341    2389    4437     6485    8533    10581    12629    14677    16725    18773
6:    1365    9557   17749    25941   34133    42325    50517    58709    66901    75093
7:    5461   38229   70997   103765  136533   169301   202069   234837   267605   300373
8:   21845  152917  283989   415061  546133   677205   808277   939349  1070421  1201493
9:   87381  611669 1135957  1660245 2184533  2708821  3233109  3757397  4281685  4805973
10: 349525 2446677 4543829  6640981 8738133 10835285 12932437 15029589 17126741 19223893
...
The triangle Te(m, n) begins (zeros are not shown):
m\n   1    2    3     4      5      6       7       8       9      10 ...
1:    1
2:    9    5
3:   17   37   21
4:   25   69  149    85
5:   33  101  277   597    341
6:   41  133  405  1109   2389   1365
7:   49  165  533  1621   4437   9557    5461
8:   57  197  661  2133   6485  17749   38229   21845
9:   65  229  789  2645   8533  25941   70997  152917   87381
10:  73  261  917  3157  10581  34133  103765  283989  611669  349525
...
----------------------------------------------------------------------------------------------
n=1, ud^2, k=1: Me(1, 1) = 1 = Te(1, 1), Ne(1) = 1 with the Collatz sequence [1, 4, 2, 1] of length 4.
n=1, ud^2, k=2: Me(1, 2) = 9 = Te(2, 1), Ne(2) = 7 with the Collatz sequence [9, 28, 14, 7] of length 4.
n=2, ud^4, k=1: Me(2, 1) = 5 = Te(2, 2), Ne(1) = 1 with the length 6 Collatz sequence [5, 16, 8, 4, 2, 1].
n=5, ud^(10), k=2: Me(5, 2) =  2389  = Te(6,5),  Ne(2) = 7 with the Collatz sequence [2389, 7168, 3584, 1792, 896, 448, 224, 112, 56, 28, 14, 7] of length 12.
		

Crossrefs

Formula

The array: Me(n, k) = 2^(2*n+1)*k - (5*2^(2*n)+1)/3 for n >= 1 and k >= 1.
The triangle: Te(m, n) = Me(n, m-n+1) = 2*4^n*(m-n) + (4^n-1)/3 for m >= n >= 1 and 0 for m < n.

A239126 Rectangular array showing the starting values M(n, k), k >= 1, for the Collatz operation (ud)^n, n >= 1, ending in an odd number, read by antidiagonals.

Original entry on oeis.org

3, 7, 7, 11, 15, 15, 15, 23, 31, 31, 19, 31, 47, 63, 63, 23, 39, 63, 95, 127, 127, 27, 47, 79, 127, 191, 255, 255, 31, 55, 95, 159, 255, 383, 511, 511, 35, 63, 111, 191, 319, 511, 767, 1023, 1023, 39, 71, 127, 223, 383, 639, 1023, 1535, 2047, 2047
Offset: 1

Views

Author

Wolfdieter Lang, Mar 13 2014

Keywords

Comments

The companion array and triangle for the odd end numbers N(n, k) is given in A239127.
The two operations on natural numbers m used in the Collatz 3x+1 conjecture are here (following the M. Trümper paper given in the link) denoted by u for 'up' and d for 'down': u m = 3*m+1, if m is odd, and d m = m/2 if m is even. The present array gives all start numbers M(n, k) for the Collatz word (ud)^n = s^n (s = ud is useful because, except for the one letter word u, at least one d follows a letter u), with n >= 1, and k >= 1. Such Collatz sequences have the maximal number of u's (grow fastest).
This rectangular array is M of Example 2.2. with x=y = n, n >= 1, of the M. Trümper reference, pp. 7-8, written as a triangle by taking NE-SW diagonals. The Collatz sequence starting with M(n, k) has length 2*n+1 for each k and it ends in the odd number N(n, k) given in A239127.
The first row sequences of the array M (columns of triangle TM) are A004767, A004771, A125169, A239128, ...

Examples

			The rectangular array M(n, k) begins:
n\k     1    2    3    4     5     6     7     8     9    10 ...
1:      3    7   11   15    19    23    27    31    35    39
2:      7   15   23   31    39    47    55    63    71    79
3:     15   31   47   63    79    95   111   127   143   159
4:     31   63   95  127   159   191   223   255   287   319
5:     63  127  191  255   319   383   447   511   575   639
6:    127  255  383  511   639   767   895  1023  1151  1279
7:    255  511  767 1023  1279  1535  1791  2047  2303  2559
8:    511 1023 1535 2047  2559  3071  3583  4095  4607  5119
9:   1023 2047 3071 4095  5119  6143  7167  8191  9215 10239
10:  2047 4095 6143 8191 10239 12287 14335 16383 18431 20479
...
The triangle TM(m, n) begins (zeros are not shown):
m\n   1    2     3     4     5     6      7      8      9    10 ...
1:    3
2:    7    7
3:   11   15    15
4:   15   23    31    31
5:   19   31    47    63    63
6:   23   39    63    95   127   127
7:   27   47    79   127   191   255    255
8:   31   55    95   159   255   383    511    511
9:   35   63   111   191   319   511    767   1023   1023
10:  39   71   127   223   383   639   1023   1535   2047  2047
...
---------------------------------------------------------------------
n=1, ud, k=1: M(1, 1) = 3 = TM(1, 1), N(1,1) = 5 with the Collatz sequence  [3, 10, 5] of length 3.
n=1, ud, k=2: M(1, 2) = 7 = TM(2, 1), N(1,2) = 11 with the Collatz sequence  [7, 22, 11] of length 3.
n=4, (ud)^4, k=2: M(4, 2) = 63 = TM(5, 4), N(4,2) = 323 with the Collatz sequence  [63, 190, 95, 286, 143, 430, 215, 646, 323] of length 9.
n=5, (ud)^5, k=1: M(5, 1) = 63 =  TM(5, 5), N(5,1) = 485 with the Collatz sequence  [63, 190, 95, 286, 143, 430, 215, 646, 323, 970, 485] of length 11.
		

Crossrefs

Formula

The array: M(n, k) = 2^(n+1)*k - 1 for n >= 1 and k >= 1.
The triangle: TM(m, n) = M(n, m-n+1) = 2^(n+1)*(m-n+1) - 1 for m >= n >= 1 and 0 for m < n.
a(n) = 4*A087808(A130328(n-1)) - 1 (conjectured). - Christian Krause, Jun 15 2021

A238476 Rectangular array with all start numbers Mo(n, k), k >= 1, for the Collatz operation ud^(2*n-1), n >= 1, ending in an odd number, read by antidiagonals.

Original entry on oeis.org

3, 7, 13, 11, 29, 53, 15, 45, 117, 213, 19, 61, 181, 469, 853, 23, 77, 245, 725, 1877, 3413, 27, 93, 309, 981, 2901, 7509, 13653, 31, 109, 373, 1237, 3925, 11605, 30037, 54613, 35, 125, 437, 1493, 4949, 15701, 46421, 120149, 218453
Offset: 1

Views

Author

Wolfdieter Lang, Mar 10 2014

Keywords

Comments

The two operations on natural numbers m used in the Collatz 3x+1 conjecture are here denoted (with M. Trümper, see the link) by u for 'up' and d for 'down': u m = 3*m+1, if m is odd, and d m = m/2 if m is even. The present array gives all start numbers Mo(n, k), k >= 1, for Collatz sequences following the pattern (word) ud^(2*n-1), with n >= 1, ending in an odd number. This end number does not depend on n and it is given by No(k) = 6*k - 1. This Collatz sequence has length 1 + (1 + 2*n - 1) = 2*n + 1.
This rectangular array is Example 2.1. with x = 2*n-1, n >= 1, of the M. Trümper reference, pp. 4-5, written as a triangle by taking NE-SW diagonals. The case x = 2*n, n >= 1, for the word ud^(2*n) appears as array and triangle A238475.
The first rows of array Mo (columns of triangle To) are A004767, A082285, A239124, ...

Examples

			The rectangular array Mo(n, k) begins:
n\k      1        2        3        4        5        6        7        8        9        10 ...
1:       3        7       11       15       19       23       27       31       35        39
2:      13       29       45       61       77       93      109      125      141       157
3:      53      117      181      245      309      373      437      501      565       629
4:     213      469      725      981     1237     1493     1749     2005     2261      2517
5:     853     1877     2901     3925     4949     5973     6997     8021     9045     10069
6:    3413     7509    11605    15701    19797    23893    27989    32085    36181     40277
7:   13653    30037    46421    62805    79189    95573   111957   128341   144725    161109
8:   54613   120149   185685   251221   316757   382293   447829   513365   578901    644437
9:  218453   480597   742741  1004885  1267029  1529173  1791317  2053461  2315605   2577749
10: 873813  1922389  2970965  4019541  5068117  6116693  7165269  8213845  9262421  10310997
...
---------------------------------------------------------------------------------------------
The triangle To(m, n) begins (zeros are not shown):
m\n    1    2    3     4     5      6      7       8       9      10 ...
1:     3
2:     7   13
3:    11   29   53
4:    15   45  117   213
5:    19   61  181   469   853
6:    23   77  245   725  1877   3413
7:    27   93  309   981  2901   7509  13653
8:    31  109  373  1237  3925  11605  30037   54613
9:    35  125  437  1493  4949  15701  46421  120149  218453
10:   39  141  501  1749  5973  19797  62805  185685  480597  873813
...
n=1, ud, k=1: Mo(1, 1) = 3 = To(1, 1), No(1) = 5 with the Collatz sequence [3, 10, 5] of length 3.
n=1, ud, k=2: Mo(1, 2) = 7 = Te(2, 1), No(2) = 11 with the Collatz sequence [7, 22, 11] of length 3.
n=5, ud^9, k=2: Mo(5, 2) = 1877 = Te(6,5), No(2) = 11 with the Collatz sequence [1877, 5632, 2816, 1408, 704, 352, 176, 88, 44, 22, 11] of length 11.
		

Crossrefs

Formula

Mo(n, k) = 2^(2*n)*k - (2^(2*n-1)+1)/3 for n >= 1 and k >= 1.
To(m, n) = Mo(n, m-n+1) = 2^(2*n)*(m-n+1) - (2^(2*n-1)+1)/3 for m >= n >= 1 and 0 for m < n.

A239127 Rectangular companion array to M(n,k), given in A239126, showing the end numbers N(n, k), k >= 1, for the Collatz operation (ud)^n, n >= 1, ending in an odd number, read by antidiagonals.

Original entry on oeis.org

5, 11, 17, 17, 35, 53, 23, 53, 107, 161, 29, 71, 161, 323, 485, 35, 89, 215, 485, 971, 1457, 41, 107, 269, 647, 1457, 2915, 4373, 47, 125, 323, 809, 1943, 4373, 8747, 13121, 53, 143, 377, 971, 2429, 5831, 13121, 26243, 39365, 59, 161, 431, 1133, 2915, 7289, 17495, 39365, 78731, 118097
Offset: 1

Views

Author

Wolfdieter Lang, Mar 13 2014

Keywords

Comments

The companion array and triangle for the odd start numbers M(n, k) is given in A239126.
See the comments on A239126 for the Collatz 3x+1 problem and the u and d operations.
This rectangular array is N of the Example 2.2. with x=y = n, n >= 1, of the M. Trümper reference, pp. 7-8, written as a triangle by taking NE-SW diagonals. The Collatz sequence starting with odd M(n, k) from A239126 and ending in odd N(n, k) has length 2*n+1 for each k.
The first row sequences of the array N (columns of triangle TN) are A016969, A239129, ...

Examples

			The rectangular array N(n, k) begins:
n\k      1      2      3      4      5      6     7       8       9      10 ...
1:       5     11     17     23     29     35     41     47      53      59
2:      17     35     53     71     89    107    125    143     161     179
3:      53    107    161    215    269    323    377    431     485     539
4:     161    323    485    647    809    971   1133   1295    1457    1619
5:     485    971   1457   1943   2429   2915   3401   3887    4373    4859
6:    1457   2915   4373   5831   7289   8747  10205  11663   13121   14579
7:    4373   8747  13121  17495  21869  26243  30617  34991   39365   43739
8:   13121  26243  39365  52487  65609  78731  91853 104975  118097  131219
9:   39365  78731 118097 157463 196829 236195 275561 314927  354293  393659
10: 118097 236195 354293 472391 590489 708587 826685 944783 1062881 1180979
...
-------------------------------------------------------------------------------
The triangle TN(m, n) begins (zeros are not shown):
m\n   1   2  3     4    5    6     7     8     9     10 ...
1:    5
2:   11  17
3:   17  35  53
4:   23  53 107  161
5:   29  71 161  323  485
6:   35  89 215  485  971 1457
7:   41 107 269  647 1457 2915  4373
8:   47 125 323  809 1943 4373  8747 13121
9:   53 143 377  971 2429 5831 13121 26243 39365
10:  59 161 431 1133 2915 7289 17495 39365 78731 118097
...
n=1, ud, k=1: M(1, 1) = 3 = TM(1, 1), N(1,1) = 5 with the Collatz sequence  [3, 10, 5] of length 3.
n=1, ud, k=2: M(1, 2) = 7 = TM(2, 1), N(1,2) = 11 with the Collatz sequence  [7, 22, 11] of length 3.
n=4, (ud)^4, k=2: M(4, 2) = 63 = TM(5, 4), N(4,2) = 323 with the Collatz sequence  [63, 190, 95, 286, 143, 430, 215, 646, 323] of length 9.
n=5, (ud)^5, k=1: M(5, 1) = 63 =  TM(5, 5), N(5,1) = 485 with the Collatz sequence  [63, 190, 95, 286, 143, 430, 215, 646, 323, 970, 485]  of length 11.
		

Crossrefs

Formula

The array: N(n, k) = 2*3^n*k - 1 for n >= 1 and k >= 1.
The triangle: TN(m, n) = N(n, m-n+1) = 2*3^n*(m-n+1) - 1 for m >= n >= 1 and 0 for m < n.

A125626 Numbers n whose reverse binary representation has the following property: let a 0 mean "halving" and a 1 mean "k -> 3k+1". The number describes an operation k -> f_n(k). If the equation f_n(k) = k has a positive solution, n is a term in the sequence.

Original entry on oeis.org

4, 8, 16, 32, 33, 34, 36, 40, 48, 64, 65, 66, 68, 72, 80, 96, 128, 129, 130, 131, 132, 133, 134, 136, 137, 138, 140, 144, 145, 146, 148, 152, 160, 161, 162, 164, 168, 176, 192, 193, 194, 196, 200, 208, 224, 256, 257, 258, 259, 260
Offset: 4

Views

Author

Nicholas Sanders (gummybean(AT)gmail.com), Jan 27 2007

Keywords

Comments

The terms in this sequence have the following characterization. Suppose the binary expansion of n contains i 1's and j 0's. Then it is easy to see that n is in the sequence if and only if 3^i < 2^j, or i/j < log 2 / log 3 = 0.630929753... - David Applegate and N. J. A. Sloane, Feb 01 2007
Note that f_n(x) is always a linear function of x.
The reverse binary expansions of the first few terms are:
001
0001
00001
000001
100001
010001
001001
000101
000011
0000001
1000001
0100001
0010001
0001001
0000101
0000011
00000001
10000001
01000001
11000001
00100001
...
Could be used in conjunction with the Collatz (or 3x+1) conjecture. If the positive solution k is an integer (most are not) then a cycle exists. If this cycle does not contain a 1 and the sequence of steps agrees with what Collatz's rule tells you to do when you start with k, then the Collatz conjecture would be false.

Examples

			Consider the term 200: its binary representation is 11001000. Reversing this gives 00010011. We solve (3*(3*(((3*(((k/2)/2)/2)+1)/2)/2)+1)+1) = k and find k = 40. Since k is positive, 200 is a member of the sequence.
		

Crossrefs

For the values of n for which the fixed point k is a positive (or any) integer, see A125754-A125757.

Programs

  • C
    #include  #include  #include  void multiply(float *coef, float *cons) { (*coef) *= 3; (*cons) = 3*(*cons)+1; } void divide(float *coef, float *cons) { (*coef) /= 2; (*cons) /= 2; } int main() { int a, b, c, n; float coef, cons, final; char data[30], sequence[30]; for (a = 1; a < 500; a++) { coef = 1; cons = 0; c = a; sequence[0] = ''; for (b = 1; b < 12; b++) //12 is arbitrary; it allows for "a" up to 2^12 { if (c != 0) { if (c % 2) { sprintf(sequence, "%s1", sequence); multiply(&coef, &cons); } else { sprintf(sequence, "%s0", sequence); divide(&coef, &cons); } c = trunc(c/2); } else break; } if (coef >= 1.0) { coef -= 1.0; cons *= -1.0; } else coef = 1.0-coef; final = cons/coef; if (final > 0) { sprintf(data, "%10.3f %s %d ", final, sequence, a); printf(data); } } return 0; }
Showing 1-8 of 8 results.