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.

A193688 Number of steps to reach 1 in Collatz (3x+1) problem starting with 2^n - 1.

Original entry on oeis.org

0, 7, 16, 17, 106, 107, 46, 47, 61, 62, 156, 157, 158, 159, 129, 130, 224, 225, 177, 178, 303, 304, 473, 474, 444, 445, 384, 385, 448, 449, 450, 451, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 852
Offset: 1

Views

Author

Arkadiusz Wesolowski, Aug 02 2011

Keywords

Crossrefs

Cf. A000225, A006577, A179118 (starting with 2^n+1).

Programs

  • Mathematica
    Table[Length[NestWhileList[If[OddQ@#, 3 # + 1, #/2] &, 2^n - 1, # > 1 &]] - 1, {n, 60}] (* Arkadiusz Wesolowski, Sep 16 2011 *)
  • Python
    for i in range(1, 100):
        n = 2**i - 1
        x = n
        c = 0
        while x != 1:
            c = c + 1
            if (x & 1) == 0:
                x = x//2
            else:
                x = 3*x + 1
        print(c)
    # David Rabahy, Sep 18 2017

Formula

For larger n, a(n) ~ 13.5*n.
a(n) = A006577(A000225(n)). - Michel Marcus, Jul 11 2023
a(2n) = 1 + a(2n-1) for n >= 2. - Alexandre Herrera, Jul 11 2023