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

A135282 Largest k such that 2^k appears in the trajectory of the Collatz 3x+1 sequence started at n.

Original entry on oeis.org

0, 1, 4, 2, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 4, 6, 8, 4, 4
Offset: 1

Views

Author

Masahiko Shin, Dec 02 2007

Keywords

Comments

Most of the first eighty terms in the sequence are 4, because the trajectories finish with 16 -> 8 -> 4 -> 2 -> 1. - R. J. Mathar, Dec 12 2007
Most of the first ten thousand terms are 4, and there only appear 4, 6, 8, and 10 in the extent, unless n is power of 2. In the other words, it seems that the trajectory of the Collatz 3x + 1 sequence ends with either 16, 64, 256 or 1024. There are few exceptional terms, for example a(10920) = 12, a(10922) = 14. It also seems all terms are even unless n is an odd power of 2. - Masahiko Shin, Mar 16 2010
It is true that all terms are even unless n is an odd power of 2: 2 == -1 mod 3, 2 * 2 == -1 * -1 == 1 mod 3. Therefore only even-indexed powers of 2 are congruent to 1 mod 3 and thus reachable by either a halving step or a "tripling step," whereas the odd-indexed powers of 2 are only reachable by a halving step or as an initial value. - Alonso del Arte, Aug 15 2010

Examples

			a(6) = 4 because the sequence is 6, 3, 10, 5, 16, 8, 4, 2, 1; there 16 = 2^4 is the largest power of 2 encountered.
		

Crossrefs

Programs

  • C
    #include  int main(){ int i, s, f; for(i = 2; i < 10000; i++){ f = 0; s = i; while(s != 1){ if(s % 2 == 0){ s = s/2; f++;} else{ f = 0; s = 3 * s + 1; } } printf("%d,", f); } return 0; } /* Masahiko Shin, Mar 16 2010 */
    
  • Haskell
    a135282 = a007814 . head . filter ((== 1) . a209229) . a070165_row
    -- Reinhard Zumkeller, Jan 02 2013
  • Maple
    A135282 := proc(n) local k,threen1 ; k := 0 : threen1 := n ; while threen1 > 1 do if 2^ilog[2](threen1) = threen1 then k := max(k,ilog[2](threen1)) ; fi ; if threen1 mod 2 = 0 then threen1 := threen1/2 ; else threen1 := 3*threen1+1 ; fi ; od: RETURN(k) ; end: for n from 1 to 80 do printf("%d, ",A135282(n)) ; od: # R. J. Mathar, Dec 12 2007
  • Mathematica
    Collatz[n_] := If[EvenQ[n], n/2, 3*n + 1]; Log[2, Table[NestWhile[Collatz, n, ! IntegerQ[Log[2, #]] &], {n, 100}]] (* T. D. Noe, Mar 05 2012 *)

Formula

a(n) = A006577(n) - A208981(n) (after Alonso del Arte's comment in A208981), if A006577(n) is not -1. - Omar E. Pol, Apr 10 2022

Extensions

Edited and extended by R. J. Mathar, Dec 12 2007
More terms from Masahiko Shin, Mar 16 2010

A347532 a(n) is the sum of the nonpowers of 2 in the 3x+1 sequence that starts at n.

Original entry on oeis.org

0, 0, 18, 0, 5, 24, 257, 0, 308, 15, 228, 36, 88, 271, 663, 0, 183, 326, 488, 35, 21, 250, 602, 60, 627, 114, 101409, 299, 411, 693, 101073, 0, 810, 217, 509, 362, 504, 526, 2313, 75, 101300, 63, 1307, 294, 466, 648, 100948, 108, 775, 677, 1099, 166, 368, 101463, 102285, 355
Offset: 1

Views

Author

Omar E. Pol, Sep 05 2021

Keywords

Comments

a(n) is the sum of the nonpowers of 2 in the n-th row of A347270.
a(n) = 0 if and only if n is a power of 2.

Examples

			For n = 6 the 3x+1 sequence starting at 6 is 6, 3, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1, ... Only the first four terms are nonpowers of 2. The sum of them is 6 + 3 + 10 + 5 = 24, so a(6) = 24.
		

Crossrefs

Cf. A208981 (number of nonpowers of 2).

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=2^ilog2(n), 0,
          n+a(`if`(n::odd, 3*n+1, n/2)))
        end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Sep 05 2021
  • Mathematica
    a[n_] := Plus @@ Select[NestWhileList[If[OddQ[#], 3*# + 1, #/2] &, n, # > 1 &], # != 2^IntegerExponent[#, 2] &]; Array[a, 50] (* Amiram Eldar, Sep 06 2021 *)

Formula

From Alois P. Heinz, Sep 05 2021: (Start)
a(n) = A033493(n) - 2 * A232503(n) + 1.
a(n) = A033493(n) - 2^(A135282(n)+1) + 1. (End)

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.

A355406 Positive integers that are not powers of 2 and whose Collatz trajectory has maximum power of 2 different from 2^4.

Original entry on oeis.org

21, 42, 75, 84, 85, 113, 150, 151, 168, 170, 201, 226, 227, 267, 300, 301, 302, 336, 340, 341, 401, 402, 403, 423, 452, 453, 454, 475, 534, 535, 537, 600, 602, 604, 605, 633, 635, 672, 680, 682, 713, 715, 802, 803, 804, 805, 806, 846, 847, 891, 904, 906, 908, 909, 950, 951, 953, 955
Offset: 1

Views

Author

Frank M Jackson, Jul 01 2022

Keywords

Comments

It is conjectured that 15/16 (93.75%) of the positive integers that are not powers of 2 have 2^4 as the maximum power of 2 in their Collatz trajectory (see A232503 and A355187). {a(n)} lists the remaining positive integers. Consequently, it is conjectured that this sequence will have lim_{n->oo} a(n)/n = 1/16.
Among the numbers from 1 to 1000, there are 10 that are powers of 2, and there are 932 others (excluding 16) whose Collatz trajectories contain 2^4 as their maximum power of 2. The remaining 58 numbers are the first 58 terms of {a(n)}.
If k is in this sequence then so is k*2^j for any j > 0. To find a "primitive" set simply eliminate the even terms (see A350160).

Examples

			21 is a term since its trajectory 21 64 32 16 8 2 1 has 64 as the highest power of 2, which is more than 16 and 21 is not itself a power of 2.
		

Crossrefs

Subset of A308149 where terms that are powers of 2 have been omitted.

Programs

  • Mathematica
    collatz[n_] := Module[{}, If[OddQ[n], 3n+1, n/2]]; step[n_] :=  Module[{p=0, m=n, q}, While[!IntegerQ[q=Log[2, m]], m=collatz[m]; p++]; {p, q, n}]; Last/@Select[Table[step[n], {n, 1, 10^5}], #[[1]]>0 && #[[2]]!=4 &]
Showing 1-4 of 4 results.