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

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.

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.
Showing 1-2 of 2 results.