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.

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

Original entry on oeis.org

1, 3, 10, 9, 96, 95, 32, 31, 43, 42, 134, 133, 132, 131, 99, 98, 190, 189, 139, 138, 261, 260, 427, 426, 394, 393, 330, 329, 390, 389, 388, 387, 461, 460, 459, 458, 457, 456, 455, 454, 453, 452, 500, 499, 498, 497, 496, 495, 494, 493, 492, 491, 746, 745, 488
Offset: 1

Views

Author

Michel Lagneau, Mar 02 2013

Keywords

Comments

It is interesting to note that the quantity 3^n - 1 appears in the Collatz trajectory of 2^n - 1 after n iterations (see the formula).

Examples

			a(8) = 31 because A193688(8)=47, and 47 - 2*8 = 31.
		

Crossrefs

Programs

  • Mathematica
    f[n_]:=Module[{a=3^n-1, k=0}, While[a>1, k++; If[EvenQ[a], a=a/2, a=a*3+1]]; k]; Table[f[n], {n,100}]
    Table[Length[NestWhileList[If[EvenQ[#],#/2,3#+1]&,3^n-1,#>1&]]-1,{n,100}] (* Harvey P. Dale, Sep 06 2015 *)

Formula

a(n) = A193688(n) - 2*n for n > 1.

A330591 Number of Collatz steps to reach 1 starting from 6^n + 1.

Original entry on oeis.org

16, 21, 26, 101, 83, 83, 145, 145, 220, 158, 145, 207, 114, 114, 450, 114, 357, 357, 282, 419, 419, 494, 494, 494, 494, 494, 494, 494, 543, 494, 543, 799, 799, 543, 543, 799, 543, 543, 799, 799, 791, 791, 791, 791, 861, 861, 861, 861, 998, 998, 998, 861, 861, 861
Offset: 1

Views

Author

Aranya Kumar Bal, Dec 18 2019

Keywords

Comments

The Collatz transform maps any positive integer k to k/2 if k is even or 3*k+1 if k is odd. There is a famous unsolved problem which says that, starting with any positive integer k, repeated application of the Collatz transform will eventually reach 1 or equivalently enter the cycle (4,2,1).
This sequence is related to A179118 and A212653, which look at the stopping times of numbers of the form 2^n+1 and 3^n+1 respectively. We note that there exist several sequences of arithmetic progressions with common difference 1 in the former and with common difference -1 in the latter. This sequence looks at stopping times of numbers of the form 2^n*3^n+1 where we see that there exist arithmetic progressions with common difference 1+(-1)=0. This is an interesting result that requires further investigation.

Examples

			a(2)=21 because the Collatz trajectory of 6^2 + 1 = 37 is
  37 -> 112 -> 56 -> 28 -> 14 ->  7 -> 22 ->
  11 ->  34 -> 17 -> 52 -> 26 -> 13 -> 40 ->
  20 ->  10 ->  5 -> 16 ->  8 ->  4 ->  2 ->  1, which is 21 steps.
		

Crossrefs

Programs

  • Mathematica
    n=200;
    For [j=1, j
    				
  • PARI
    nbsteps(n) = if(n<0, 0, my(s=n, c=0); while(s>1, s=if(s%2, 3*s+1, s/2); c++); c); \\ A006577
    a(n) = nbsteps(6^n+1); \\ Michel Marcus, Dec 21 2019
  • Python
    from decimal import *
    n=1000
    for j in range(2,n):
      i=6**j+1
      count=0
      while(i!=1):
        if(i%2==0):
          i=i//2
        else:
          i=3*i+1
        count=count+1
      print(count)
    

Formula

a(n) = A006577(6^n+1).
Showing 1-2 of 2 results.