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 10 results.

A288605 Position of first appearance of each integer in A088568 (number of 1's minus number of 2's in first n terms of A000002).

Original entry on oeis.org

0, 1, 3, 12, 32, 93, 257, 378, 471, 798, 825, 858, 1127, 1398, 1497, 1524, 1533, 6352, 6969, 7176, 7269, 7566, 7971, 20338, 20371, 21982, 22009, 25638, 25665, 25692, 27969, 39184, 39211, 42398, 43129, 43150, 48637, 48730, 48757, 49014, 49041, 49068, 49095, 49864
Offset: 1

Views

Author

Gus Wiseman, Jun 11 2017

Keywords

Comments

For the definition of this sequence we assume A088568(0) = 0.

Examples

			A088568(12) = -2 is the first appearance of -2 in A088568, so 12 belongs to the sequence.
A088568(32) = 2 is the first appearance of 2, so 32 belongs to the sequence.
		

Crossrefs

Programs

  • Mathematica
    Map[First, Values@ #] - 1 &@ PositionIndex@ Prepend[#, 0] &@ MapIndexed[3 First@ #2 - 2 #1 &, Accumulate@ Prepend[Nest[Flatten[Partition[#, 2] /. {{2, 2} -> {2, 2, 1, 1}, {2, 1} -> {2, 2, 1}, {1, 2} -> {2, 1, 1}, {1, 1} -> {2, 1}}] &, {2, 2}, 25], 1]] (* Michael De Vlieger, Jun 12 2017, after Birkas Gyorgy at A000002 *)

A208981 Number of iterations required to reach a power of 2 in the 3x+1 sequence starting at n.

Original entry on oeis.org

0, 0, 3, 0, 1, 4, 12, 0, 15, 2, 10, 5, 5, 13, 13, 0, 8, 16, 16, 3, 1, 11, 11, 6, 19, 6, 107, 14, 14, 14, 102, 0, 22, 9, 9, 17, 17, 17, 30, 4, 105, 2, 25, 12, 12, 12, 100, 7, 20, 20, 20, 7, 7, 108, 108, 15, 28, 15, 28, 15, 15, 103, 103, 0, 23, 23, 23, 10, 10, 10
Offset: 1

Views

Author

L. Edson Jeffery, Mar 04 2012

Keywords

Comments

The original name was: Number of iterations of the Collatz recursion required to reach a power of 2.
The statement that all paths must eventually reach a power of 2 is equivalent to the Collatz conjecture.
A006577(n) - a(n) gives the exponent for the first power of 2 reached in the Collatz trajectory of n. - Alonso del Arte, Mar 05 2012
Number of nonpowers of 2 in the 3x+1 sequence starting at n. - Omar E. Pol, Sep 05 2021

Examples

			a(7) = 12 because the Collatz trajectory for 7 is 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1, ... which reached 16 = 2^4 in 12 steps.
		

Crossrefs

Row sums of A347519.
Cf. A006577 (and references therein).
Cf. A347270 (gives all 3x+1 sequences).

Programs

  • Haskell
    a208981 = length . takeWhile ((== 0) . a209229) . a070165_row
    -- Reinhard Zumkeller, Jan 02 2013
    
  • Maple
    a:= proc(n) option remember; `if`(n=2^ilog2(n), 0,
          1+a(`if`(n::odd, 3*n+1, n/2)))
        end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Sep 05 2021
  • Mathematica
    Collatz[n_?OddQ] := 3*n + 1; Collatz[n_?EvenQ] := n/2; Table[-1 + Length[NestWhileList[Collatz, n, Not[IntegerQ[Log[2, #]]] &]], {n, 50}] (* Alonso del Arte, Mar 04 2012 *)
  • PARI
    ispow2(n)=n>>=valuation(n,2); n==1
    a(n)=my(s); while(!ispow2(n), n=if(n%2, 3*n+1, n/2); s++); s \\ Charles R Greathouse IV, Jul 31 2016

Formula

For x>0 an integer, define f_0(x)=x, and for r=1,2,..., f_r(x)=f_{r-1}(x)/2 if f_{r-1}(x) is even, else f_r(x)=3*f_{r-1}(x)+1. Then a(n) = min(k such that f_k(n) is equal to a power of 2).
a(n) = A006577(n) - A135282(n) (after Alonso del Arte's comment), if A006577(n) is not -1. - Omar E. Pol, Apr 10 2022

Extensions

Name clarified by Omar E. Pol, Apr 10 2022

A070167 a(n) is the smallest starting value that produces a Collatz sequence in which n occurs.

Original entry on oeis.org

1, 2, 3, 3, 3, 6, 7, 3, 9, 3, 7, 12, 7, 9, 15, 3, 7, 18, 19, 7, 21, 7, 15, 24, 25, 7, 27, 9, 19, 30, 27, 21, 33, 7, 15, 36, 37, 25, 39, 7, 27, 42, 43, 19, 45, 15, 27, 48, 43, 33, 51, 7, 15, 54, 55, 37, 57, 19, 39, 60, 27, 27, 63, 21, 43, 66, 39, 45, 69, 15, 27, 72, 73, 43, 75, 25
Offset: 1

Views

Author

Eric W. Weisstein, Apr 23 2002

Keywords

Comments

a(n) <= n. - Robert G. Wilson v, Jan 14 2015

Crossrefs

Programs

  • Haskell
    import Data.List (findIndex)
    import Data.Maybe (fromJust)
    a070167 n = fromJust (findIndex (elem n) a070165_tabf) + 1
    -- Reinhard Zumkeller, Jan 02 2013
  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; nn = 100; t = Table[0, {nn}]; n = 0; zeros = nn; While[zeros > 0, n++; c = Collatz[n]; Do[If[i <= nn && t[[i]] == 0, t[[i]] = n; zeros--], {i, c}]]; t (* T. D. Noe, Dec 03 2012 *)

A054646 Smallest number to give 2^(2n) in a hailstone (or 3x + 1) sequence.

Original entry on oeis.org

1, 3, 21, 75, 151, 1365, 5461, 14563, 87381, 184111, 932067, 5592405, 13256071, 26512143, 357913941, 1431655765, 3817748707, 22906492245, 91625968981, 244335917283, 1466015503701, 5212499568715, 10424999137431
Offset: 1

Views

Author

Jeff Heleen, Apr 16 2000

Keywords

Comments

In hailstone sequences, only even powers of 2 are obtained as a final peak before descending to 1. [I assume this should really say: "These are numbers whose 3x+1 trajectory has the property that the final peak before descending to 1 is an even power of 2." - N. J. A. Sloane, Jul 22 2020]
For n>1, this a bisection of A010120. For n=3,6,7,9,12,15,16,18,19,21, we have a(n)=(4^n-1)/3, the largest possible value because one 3x+1 step produces 2^(2n). - T. D. Noe, Feb 19 2010

Examples

			The "3x+1" sequence starting at 21 is 21, 64, 32, 16, 8, 4, 2, 1, ..., and is the smallest start which contains 64 = 2^(2*3). So a(3) = 21. - _N. J. A. Sloane_, Jul 22 2020
		

References

  • J. Heleen, Final Peak Sequences for Hailstone Numbers, 1993, preprint. [Apparently unpublished as of June 2017]

Programs

  • Haskell
    a054646 1 = 1
    a054646 n = a070167 $ a000302 n  -- Reinhard Zumkeller, Jan 02 2013

Formula

For n > 1: a(n) = A070167(A000302(n)). - Reinhard Zumkeller, Jan 02 2013

A247272 Odd numbers m containing 256 as the highest power of 2 in their Collatz (3x+1) iteration.

Original entry on oeis.org

75, 85, 113, 267, 301, 401, 453, 475, 535, 633, 713, 803, 951, 1069, 1205, 1267, 1425, 1427, 1605, 1611, 1689, 1813, 1901, 2141, 2251, 2417, 2533, 2667, 2671, 2811, 2851, 2853, 3001, 3003, 3163, 3213, 3223, 3377, 3379, 3559, 3561, 3751, 3801, 3805, 3819, 3951, 4001, 4007, 4217, 4277
Offset: 1

Views

Author

Derek Orr, Sep 22 2014

Keywords

Comments

a(n)*2^k also contains 256 as the highest power of 2 for any k >= 0.

Crossrefs

Programs

  • Mathematica
    hp256Q[n_]:=Max[Select[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&],IntegerQ[ Log[ 2,#]]&]]==256; Select[Range[1,4301,2],hp256Q] (* Harvey P. Dale, Feb 10 2019 *)
  • PARI
    Max2(n)=v=[n];while(n!=1,if(n==Mod(0,2),n=n/2;v=concat(v,n));if(n==Mod(1,2)&&n!=1,n=3*n+1;v=concat(v,n)));k=1;while(vecsearch(vecsort(v),2^k),k++);2^(k-1)
    n=1;while(n<10^4,if(n%2&&Max2(n)==256,print1(n,", "));n++)

A247346 Odd numbers n containing 1024 as the highest power of 2 in their Collatz (3x+1) iteration.

Original entry on oeis.org

151, 201, 227, 341, 403, 423, 537, 605, 635, 715, 805, 847, 891, 909, 953, 955, 1003, 1073, 1075, 1129, 1131, 1191, 1271, 1273, 1337, 1431, 1433, 1505, 1613, 1693, 1697, 1783, 1787, 1907, 1911, 2007, 2011, 2147, 2149, 2257, 2259, 2263, 2377, 2383, 2421, 2503, 2541, 2547, 2675, 2681
Offset: 1

Views

Author

Derek Orr, Sep 22 2014

Keywords

Comments

a(n)*2^k also contains 1024 as the highest of 2 for any k >= 0.

Crossrefs

Programs

  • PARI
    Max2(n)=v=[n]; while(n!=1, if(n==Mod(0, 2), n=n/2; v=concat(v, n)); if(n==Mod(1, 2)&&n!=1, n=3*n+1; v=concat(v, n))); k=1; while(vecsearch(vecsort(v), 2^k), k++); 2^(k-1)
    n=1;while(n<10^4,if(n%2&&Max2(n)==1024,print1(n,", "));n++)

A231610 The least k such that the Collatz (3x+1) iteration of k contains 2^n as the largest power of 2.

Original entry on oeis.org

1, 2, 4, 8, 3, 32, 21, 128, 75, 512, 151, 2048, 1365, 8192, 5461, 32768, 14563, 131072, 87381, 524288, 184111, 2097152, 932067, 8388608, 5592405, 33554432, 13256071, 134217728, 26512143, 536870912, 357913941, 2147483648, 1431655765, 8589934592, 3817748707
Offset: 0

Views

Author

T. D. Noe, Dec 02 2013

Keywords

Comments

Very similar to A225124, where 2^n is the largest number in the Collatz iteration of A225124(n). The only difference appears to be a(8), which is 75 here and 85 in A225124. The Collatz iteration of 75 is {75, 226, 113, 340, 170, 85, 256, 128, 64, 32, 16, 8, 4, 2, 1}.

Examples

			The iteration for 21 is {21, 64, 32, 16, 8, 4, 2, 1}, which shows that 64 = 2^6 is a term. However, 32 is not the first power of two. We have to wait until the iteration for 32, which is {32, 16, 8, 4, 2, 1}, to see 32 = 2^5 as the first power of two.
		

Crossrefs

Cf. A010120, A054646 (similar sequences).
Cf. A135282, A232503 (largest power of 2 in the Collatz iteration of n).
Cf. A225124.

Programs

  • Mathematica
    Collatz[n_?OddQ] := 3*n + 1; Collatz[n_?EvenQ] := n/2; nn = 21; t = Table[-1, {nn}]; n = 0; cnt = 0; While[cnt < nn, n++; q = Log[2, NestWhile[Collatz, n, Not[IntegerQ[Log[2, #]]] &]]; If[q < nn && t[[q + 1]] == -1, t[[q + 1]] = n; cnt++]]; t

Formula

a(n) = 2^n for odd n.

A247715 Odd numbers n containing 16384 as the highest power of 2 in the Collatz (3x+1) iteration.

Original entry on oeis.org

5461, 7281, 29125, 38833, 51777, 77667, 103555, 116501, 122731, 138073, 155333, 163641, 184097, 207109, 245463, 276145, 276147, 310669, 327283, 368193, 368195, 414221, 414225, 436377, 466005, 490925, 552291, 552293, 581835, 621333, 654565, 689583, 736387, 736389, 828437, 828451
Offset: 1

Views

Author

Derek Orr, Sep 22 2014

Keywords

Comments

a(n)*2^k also contains 16384 as the highest power of 2 for any k >= 0.

Crossrefs

Programs

  • PARI
    Max2(n)=v=[n]; while(n!=1, if(n==Mod(0, 2), n=n/2; v=concat(v, n)); if(n==Mod(1, 2)&&n!=1, n=3*n+1; v=concat(v, n))); k=1; while(vecsearch(vecsort(v), 2^k), k++); 2^(k-1)
    n=1; while(n<10^4, if(n%2&&Max2(n)==16384, print1(n, ", ")); n++)

A247716 Odd numbers n containing 65536 as the highest power of 2 in their Collatz (3x+1) iteration.

Original entry on oeis.org

14563, 17259, 19417, 20455, 21845, 25889, 27273, 30683, 34519, 38835, 40911, 46025, 51779, 54547, 58253, 61367, 64647, 69037, 72729, 77669, 81821, 92049, 92051, 96971, 103557, 107623, 109093, 109095, 122733, 129295, 138077, 143497, 145457, 145459, 153243, 155341, 161435
Offset: 1

Views

Author

Derek Orr, Sep 22 2014

Keywords

Comments

a(n)*2^k also contains 65536 as the highest power of 2 for any k >= 0.

Crossrefs

Programs

  • PARI
    Max2(n)=v=[n]; while(n!=1, if(n==Mod(0, 2), n=n/2; v=concat(v, n)); if(n==Mod(1, 2)&&n!=1, n=3*n+1; v=concat(v, n))); k=1; while(vecsearch(vecsort(v), 2^k), k++); 2^(k-1)
    n=1; while(n<10^4, if(n%2&&Max2(n)==65536, print1(n, ", ")); n++)

A287319 Smallest number k which becomes a power of 2 after being transformed by the reduced Collatz function k=(3*k+1)/2 precisely n times.

Original entry on oeis.org

1, 3, 151, 26512143, 318400215865581346424671, 1240913164837493520914469575281720548839055905624577375251388717505927743
Offset: 1

Views

Author

Joe Slater, May 23 2017

Keywords

Comments

a(7) is too large to include.
I conjecture that all members of a(n) are members of A054646 and A010120, "Smallest number to give 2^(2n) in a hailstone (3x + 1) sequence" and "Smallest start for a `3x+1' sequence containing 2^n".

Examples

			For n = 3, the reduced Collatz sequence k = (3*k+1)/2 is 151, 227, 341, 512.
		

Crossrefs

Cf. A054646 and A010120.

Formula

a(n) = ((2^(3^(n-1)+n)-3^n+2^n))/3^n.
Showing 1-10 of 10 results.