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.

A125719 A127885(prime(n)).

Original entry on oeis.org

1, 7, 5, 16, 14, 9, 12, 20, 15, 18, 31, 13, 21, 21, 29, 11, 24, 19, 27, 27, 27, 27, 22, 22, 30, 25, 30, 38, 25, 12, 46, 20, 28, 33, 15, 15, 28, 23, 23, 23, 23, 18, 44, 31, 18, 31, 31, 44, 13, 26, 26, 26, 21, 39, 34, 34, 21, 34, 16, 34, 34, 29, 29, 29, 29, 29, 24, 37, 37, 24, 24, 24, 37
Offset: 1

Views

Author

David Applegate and N. J. A. Sloane, Feb 06 2007

Keywords

Crossrefs

A181777 Number of steps to reach 1 in '3x+1' (or Collatz) problem starting with the n-th Mersenne prime.

Original entry on oeis.org

7, 16, 106, 46, 158, 224, 177, 450, 860, 1454, 1441, 1660, 6769, 8494, 17094, 29821, 30734, 43478, 55906, 60716, 129608, 134345, 153505, 265860, 293161, 312164, 598067, 1158876, 1482529, 1771117, 2906179, 10197081, 11568589, 16927967, 18807193, 40055567, 40663017, 93778449, 181209792, 282515044, 323346876, 349304386, 409093991, 438465334, 499902411, 573966881, 580260946
Offset: 1

Views

Author

Frank M Jackson, Dec 23 2012

Keywords

Comments

Sequence currently gives the data for the 48 known Mersenne primes (A000043).
It is conjectured by Ohira and Watanabe that for large Mersenne primes 2^k-1, the fraction steps/k ~ 2+3*log(3)/log(4/3) or approximately 13.45.
The confirmed number of steps to reach 1 for other known Mersenne primes S(Mp) above 45th (M37156667): S(M42643801) = 573966881, S(M43112609) = 580260946, S(M57885161) = 779044992, S(M74207281) = 998401306. - Andrey S. Shchebetov and Sergei D. Shchebetov, Nov 14 2017
S(M77232917) = 1039248803. - Andrey S. Shchebetov and Sergei D. Shchebetov, Apr 25 2018
S(M82589933) = 1111148968. Also confirming all previous results. - Martin Raab, Apr 28 2023
S(M136279841) = 1833585702. - Roderick MacPhee, Oct 21 2024

Examples

			a(1)=7 as the first Mersenne prime is 3. So starting at 3 the steps are 10, 5, 16, 8, 4, 2, 1.
		

Crossrefs

Programs

  • Mathematica
    collatz[k_] := (If[OddQ[k], j=3k+1, j=k/2]; j); step[m_] := (p=1; n=m; While[n!=1, (n=collatz[n]; p++)]; p-1); list = {2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607, 1279, 2203, 2281, 3217, 4253, 4423, 9689, 9941, 11213, 19937, 21701, 23209, 44497, 86243, 110503, 132049, 216091, 756839, 859433, 1257787, 1398269, 2976221, 3021377, 6972593, 13466917, 20996011, 24036583, 25964951}; Table[step[2^s-1], {s,list}] (* warning: the list should be limited so as to run in a reasonable amount of time *)
  • PARI
    \\ See Raab link. \\ Martin Raab, May 11 2023

Extensions

a(43)-a(45) from Andrey S. Shchebetov and Sergei D. Shchebetov, Sep 22 2017
Edited by N. J. A. Sloane, Sep 26 2017
a(46)-a(47) from Sergei D. Shchebetov, Apr 25 2018
a(48) from Roderick MacPhee, Oct 21 2024

A246009 Length of Collatz cycles '3*n + 1' of prime numbers.

Original entry on oeis.org

2, 8, 6, 17, 15, 10, 13, 21, 16, 19, 107, 22, 110, 30, 105, 12, 33, 20, 28, 103, 116, 36, 111, 31, 119, 26, 88, 101, 114, 13, 47, 29, 91, 42, 24, 16, 37, 24, 68, 32, 32, 19, 45, 120, 27, 120, 40, 71, 14, 35, 84, 53, 22, 66, 123, 79, 30, 43, 17, 43, 61, 118, 38, 87, 131, 38, 25, 113, 126, 33, 126, 51, 46, 20, 59
Offset: 1

Views

Author

Freimut Marschner, Aug 12 2014

Keywords

Comments

Define a Collatz cycle C(prime(n)) = {c(z+1) = c(z)/2 if c(z) mod 2 = 0, otherwise c(z+1) = 3*c(z) + 1}, z >= 1, c(1) = prime(n), n >= 1}; then the length of C(prime(n)) depends only on the starting point c(1) if C ends with c(z) = 1. The length of C(prime(n)) is z, so a(n) = z.
The longest C(prime(n)) out of 10^5 prime numbers is C(prime(96648)) = C(1252663) with a(96648) = 510.
Until now C is not proved mathematically. So if the ending point c(z) is not equal to 1 then C(prime(n)) is not a 'true' Collatz cycle or does not exist.

Examples

			a(1) = {c(1) = prime(1) = 2, 2 mod 2 = 0, c(2) = 2/2 = 1, z=2} = 2;
a(3) = {c(1) = prime(3) = 5, 5 mod 2 = 1, c(2) = 3*5 + 1 = 16; 16 mod 2 = 0, c(3) = 16/2 = 8; 8 mod 2 = 0, c(4) = 8/2 = 4; 4 mod 2 = 0, c(5) = 4/2 = 2; 2 mod 2 = 0, c(6) = 2/2 = 1, z=6} = 6.
		

Crossrefs

A006577 (Number of halving and tripling steps to reach 1 in '3x+1' problem), A070975 (Number of steps to reach 1 in '3x+1' (or Collatz) problem starting with prime(n)).

Programs

  • PARI
    a(n)=n=prime(n);A=List;while(n != 1,listput(A,n);if(n%2==0,n=n/2,n=3*n+1));listput(A,1);return(#Vec(A)) \\ Edward Jiang, Sep 06 2014

Formula

a(n) = z where {c(z+1) = c(z)/2 if c(z) mod 2 = 0, otherwise c(z+1) = 3*c(z) + 1}, z >= 1, c(1) = prime(n), n >= 1}, a(n) = A006577(prime(n)) + 1 = A070975(n) + 1.

A288023 Number of steps to reach 1 in the Collatz 3x+1 problem starting with the n-th triangular number, or -1 if 1 is never reached.

Original entry on oeis.org

0, 7, 8, 6, 17, 7, 18, 21, 16, 112, 27, 35, 92, 38, 20, 15, 36, 124, 106, 39, 127, 109, 16, 16, 24, 81, 107, 40, 27, 35, 110, 30, 43, 74, 38, 113, 170, 46, 121, 28, 103, 116, 36, 98, 124, 137, 18, 119, 132, 83, 26, 127, 26, 47, 34, 122, 91, 148, 117, 130, 37, 37, 112, 32, 76, 94, 58, 120, 120, 89, 133, 53, 115, 66
Offset: 1

Views

Author

Keywords

Examples

			For n = 2, the 2nd triangular number is 3, which takes 7 steps to reach 1 in the Collatz (3x+1) problem: (10, 5, 16, 8, 4, 2, 1).
		

Crossrefs

Programs

  • Mathematica
    Table[Length[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&]]-1,{n,Accumulate[ Range[80]]}] (* Harvey P. Dale, Aug 17 2017 *)
  • Python
    num = 1
    def triangleN(x):
        return x*(x+1)/2
    def stepCount(x):
        x = int(x)
        steps = 0
        while True:
            if x == 1:
                break
            elif x % 2 == 0:
                x = x/2
                steps += 1
            else:
                x = x*3 + 1
                steps += 1
        return steps
    while True:
        print(stepCount(triangleN(num)))
        num += 1

Formula

a(n) = A006577(A000217(n)). - Omar E. Pol, Jun 04 2017
Showing 1-4 of 4 results.