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

A138895 Triangle read by rows: T(n,k) = A092892(n-k) for 0 <= k <= n.

Original entry on oeis.org

1, 2, 1, 4, 2, 1, 8, 4, 2, 1, 5, 8, 4, 2, 1, 3, 5, 8, 4, 2, 1, 6, 3, 5, 8, 4, 2, 1, 12, 6, 3, 5, 8, 4, 2, 1, 24, 12, 6, 3, 5, 8, 4, 2, 1, 17, 24, 12, 6, 3, 5, 8, 4, 2, 1, 11, 17, 24, 12, 6, 3, 5, 8, 4, 2, 1
Offset: 0

Views

Author

Paul Barry, Apr 02 2008

Keywords

Comments

Matrix in Toeplitz form related to the Collatz (3x + 1) algorithm.
Row sums are A138847. Antidiagonal sums are A138848.

Examples

			Triangle begins
   1;
   2,  1;
   4,  2,  1;
   8,  4,  2,  1;
   5,  8,  4,  2,  1;
   3,  5,  8,  4,  2,  1;
   6,  3,  5,  8,  4,  2,  1;
  12,  6,  3,  5,  8,  4,  2,  1;
  24, 12,  6,  3,  5,  8,  4,  2,  1;
  17, 24, 12,  6,  3,  5,  8,  4,  2,  1;
  11, 17, 24, 12,  6,  3,  5,  8,  4,  2,  1;
  ...
		

Crossrefs

Cf. A092892 (1st column), A138847, A138848.

Extensions

Edited by Georg Fischer, Jul 28 2023

A006666 Number of halving steps to reach 1 in '3x+1' problem, or -1 if this never happens.

Original entry on oeis.org

0, 1, 5, 2, 4, 6, 11, 3, 13, 5, 10, 7, 7, 12, 12, 4, 9, 14, 14, 6, 6, 11, 11, 8, 16, 8, 70, 13, 13, 13, 67, 5, 18, 10, 10, 15, 15, 15, 23, 7, 69, 7, 20, 12, 12, 12, 66, 9, 17, 17, 17, 9, 9, 71, 71, 14, 22, 14, 22, 14, 14, 68, 68, 6, 19, 19, 19, 11, 11, 11, 65, 16, 73, 16, 11, 16
Offset: 1

Views

Author

Keywords

Comments

Equals the total number of steps to reach 1 under the modified '3x+1' map: T(n) = n/2 if n is even, (3n+1)/2 if n is odd (see A014682).
Pairs of consecutive integers of the same height occur infinitely often and in infinitely many different patterns (Garner 1985). - Joe Slater, May 24 2018

Examples

			2 -> 1 so a(2) = 1; 3 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1, with 5 halving steps, so a(3) = 5; 4 -> 2 -> 1 has two halving steps, so a(4) = 2; etc.
		

References

  • R. K. Guy, Unsolved Problems in Number Theory, E16.
  • J. C. Lagarias, ed., The Ultimate Challenge: The 3x+1 Problem, Amer. Math. Soc., 2010.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A006370, A006577, A006667 (tripling steps), A014682, A092892, A127789 (record indices of 2^a(n)/(3^A006667(n)*n)).

Programs

  • Haskell
    a006666 = length . filter even . takeWhile (> 1) . (iterate a006370)
    -- Reinhard Zumkeller, Oct 08 2011
    
  • Maple
    # A014682
    T:=proc(n) if n mod 2 = 0 then n/2 else (3*n+1)/2; fi; end;
    # A006666
    t1:=[0]:
    for n from 2 to 100 do
    L:=1; p := n;
    while T(p) <> 1 do p:=T(p); L:=L+1; od:
    t1:=[op(t1),L];
    od: t1;
  • Mathematica
    Table[Count[NestWhileList[If[OddQ[#],3#+1,#/2]&,n,#>1&],?(EvenQ[#]&)], {n,80}] (* _Harvey P. Dale, Sep 30 2011 *)
  • PARI
    a(n)=my(t); while(n>1, if(n%2, n=3*n+1, n>>=1; t++)); t \\ Charles R Greathouse IV, Jun 21 2017
  • Python
    def a(n):
        if n==1: return 0
        x=0
        while True:
            if not n%2:
                n//=2
                x+=1
            else: n = 3*n + 1
            if n<2: break
        return x
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Apr 14 2017
    

Formula

A092892(a(n)) = n and A092892(m) <> n for m < a(n). - Reinhard Zumkeller, Mar 14 2014
a(2^n) = n. - Bob Selcoe, Apr 16 2015
a(n) = ceiling(log(n*3^A006667(n))/log(2)). - Joe Slater, Aug 30 2017
a(2^k-1) = a(2^(k+1)-1)-1, for odd k>1. - Joe Slater, May 17 2018
a(n) = a(A085062(n)) + A007814(n+1) + 1 for n >= 2. - Alan Michael Gómez Calderón, Feb 01 2025

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Apr 27 2001
Name edited by M. F. Hasler, May 07 2018

A092893 Smallest starting value in a Collatz '3x+1' sequence such that the sequence contains exactly n tripling steps.

Original entry on oeis.org

1, 5, 3, 17, 11, 7, 9, 25, 33, 43, 57, 39, 105, 135, 185, 123, 169, 219, 159, 379, 283, 377, 251, 167, 111, 297, 395, 263, 175, 233, 155, 103, 137, 91, 121, 161, 107, 71, 47, 31, 41, 27, 73, 97, 129, 171, 231, 313, 411, 543, 731, 487, 327, 859, 1145, 763, 1017, 1351
Offset: 0

Views

Author

Hugo Pfoertner, Mar 11 2004

Keywords

Comments

First occurrence of n in A006667.
These are the odd (primitive) terms in A129304. - T. D. Noe, Apr 09 2007
Except for a(1) = 5, all values are congruent {1, 3, 7} (mod 8). Reason: If n is 5 (mod 8) then the Collatz trajectory starting with m = (n - 1)/4 contains the same number of tripling steps, because n = 4m + 1 and the Collatz 3x + 1 step results in 3*(4m + 1) + 1 = 12m + 4 which gets reduced by halving to 3m + 1, without changing the number of tripling steps. - Ralf Stephan, Jun 19 2025

Examples

			a(4)=11 because the Collatz sequence 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1 is the first sequence containing 4 tripling steps.
		

Crossrefs

Row n=1 of A354236.

Programs

  • Mathematica
    a[n_]:=Length[Select[NestWhileList[If[EvenQ[#],#/2,3#+1] &,n,#>1 &],OddQ]]; Table[i=1; While[a[i]!=n,i=i+2]; i,{n,58}] (* Jayanta Basu, May 27 2013 *)

A138847 Row sums of a Collatz triangle.

Original entry on oeis.org

1, 3, 7, 15, 20, 23, 29, 41, 65, 82, 93, 100, 114, 123, 141, 177, 202, 251, 284, 349, 392, 478, 535, 574, 652, 805, 910, 1113, 1248, 1518, 1703, 1826, 2072, 2241, 2570, 2789, 2948, 3243, 3812, 4191, 4474, 4979, 5356, 5607, 5774, 5885, 6107
Offset: 0

Views

Author

Paul Barry, Mar 31 2008, Apr 02 2008

Keywords

Crossrefs

Partial sums of A092892.
Row sums of A138895.

Formula

a(n) = Sum_{k=0..n} A092892(k).
a(n) = Sum_{k=0..n} A138895(n,k).

A138848 Diagonal sums of a Collatz triangle.

Original entry on oeis.org

1, 2, 5, 10, 10, 13, 16, 25, 40, 42, 51, 49, 65, 58, 83, 94, 108, 143, 141, 208, 184, 294, 241, 333, 319, 486, 424, 689, 559, 959, 744, 1082, 990, 1251, 1319, 1470, 1478, 1765, 2047, 2144, 2330, 2649, 2707, 2900, 2874, 3011, 3096, 3455
Offset: 0

Views

Author

Paul Barry, Mar 31 2008, Apr 02 2008

Keywords

Comments

Diagonal sums of A138895.

Formula

a(n)=sum{k=0..floor(n/2), A092892(n-2k)}

A138846 Erroneous version of A138895.

Original entry on oeis.org

1, 2, 1, 4, 2, 1, 8, 4, 2, 1, 5, 8, 4, 2, 1, 3, 5, 8, 4, 2, 1, 6, 3, 5, 8, 4, 2, 1, 12, 6, 3, 5, 8, 4, 2, 1, 24, 12, 6, 3, 5, 8, 4, 2, 1, 17, 26, 13, 20, 10, 5, 8, 4, 2, 1, 11, 17, 26, 13, 20, 10, 5, 8, 4, 2, 1
Offset: 0

Views

Author

Paul Barry, Mar 31 2008, Apr 02 2008

Keywords

Comments

Former definition was: Triangle read by rows: T(n,k) = A092892(n-k) if k <= n, 0 otherwise.

Examples

			Triangle begins
   1;
   2,  1;
   4,  2,  1;
   8,  4,  2,  1;
   5,  8,  4,  2,  1;
   3,  5,  8,  4,  2,  1;
   6,  3,  5,  8,  4,  2,  1;
  12,  6,  3,  5,  8,  4,  2,  1;
  24, 12,  6,  3,  5,  8,  4,  2,  1;
  17, 26, 13, 20, 10,  5,  8,  4,  2,  1;
  11, 17, 26, 13, 20, 10,  5,  8,  4,  2,  1;
		
Showing 1-6 of 6 results.