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-10 of 221 results. Next

A074473 Dropping time for the 3x+1 problem: for n >= 2, number of iteration that first becomes smaller than the initial value if Collatz-function (A006370) is iterated starting at n; a(1)=1 by convention.

Original entry on oeis.org

1, 2, 7, 2, 4, 2, 12, 2, 4, 2, 9, 2, 4, 2, 12, 2, 4, 2, 7, 2, 4, 2, 9, 2, 4, 2, 97, 2, 4, 2, 92, 2, 4, 2, 7, 2, 4, 2, 14, 2, 4, 2, 9, 2, 4, 2, 89, 2, 4, 2, 7, 2, 4, 2, 9, 2, 4, 2, 12, 2, 4, 2, 89, 2, 4, 2, 7, 2, 4, 2, 84, 2, 4, 2, 9, 2, 4, 2, 14, 2, 4, 2, 7, 2, 4, 2, 9, 2, 4, 2, 74, 2, 4, 2, 14, 2, 4, 2, 7
Offset: 1

Views

Author

Labos Elemer, Sep 19 2002

Keywords

Comments

Here we call the starting value iteration number 1, although usually the count is started at 0, which would subtract 1 from the values for n >= 2 - see A060445, A102419.

Examples

			n=2k: then a(2k)=2 because the second iterate is k<n=2k, the first iterate below 2k; n=4k+1, k>1: the list = {4k+1, 12k+4, 6k+2, 3k+1, ...} i.e. the 4th term is always the first below initial value, so a(4k+1)=4;
n=15: the list={15, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1} and 12th term is first sinks below iv=15, so a(15)=12; relatively larger values occur at n=4k+3.
n=3: the list is {3, 10, 5, 16, 8, 4, 2, 1, ..}, the 7th term is 2, which is the first smaller than 3, so a(3)=7.
		

Crossrefs

Programs

  • Mathematica
    nextx[x_Integer] := If[OddQ@x, 3x + 1, x/2]; f[1] = 1; f[n_] := Length@ NestWhileList[nextx, n, # >= n &]; Array[f, 83] (* Bobby R. Treat (drbob(at)bigfoot.com), Sep 16 2006 *)
  • PARI
    A074473(n) = if (n<3, n,  my(N=n, x=1); while (1, if (n%2==0, n/=2, n = 3*n + 1); x++; if (nMichel Marcus, Aug 15 2025
  • Python
    def a(n):
        if n<3: return n
        N=n
        x=1
        while True:
            if n%2==0: n/=2
            else: n = 3*n + 1
            x+=1
            if nIndranil Ghosh, Apr 15 2017
    

Extensions

Edited by N. J. A. Sloane, Sep 15 2006

A341515 The Collatz or 3x+1 map (A006370) conjugated by unary-binary-encoding (A156552).

Original entry on oeis.org

1, 5, 2, 15, 3, 11, 5, 45, 4, 125, 7, 33, 11, 245, 6, 135, 13, 77, 17, 375, 10, 605, 19, 99, 9, 845, 8, 735, 23, 17, 29, 405, 14, 1445, 15, 231, 31, 1805, 22, 1125, 37, 1331, 41, 1815, 12, 2645, 43, 297, 25, 275, 26, 2535, 47, 539, 21, 2205, 34, 4205, 53, 51, 59, 4805, 20, 1215, 33, 1859, 61, 4335, 38, 3125, 67, 693
Offset: 1

Views

Author

Antti Karttunen, Feb 14 2021

Keywords

Comments

Collatz-conjecture can be formulated via this sequence by postulating that all iterations of a(n), starting from any n > 1, will eventually reach the cycle [2, 5, 3].

Crossrefs

Cf. A005940, A006370, A064989, A156552, A329603, A341510, A347115 (Möbius transform),
Sequences related to iterations of this sequence: A352890, A352891, A352892, A352893, A352894, A352896, A352897, A352898, A352899.
Cf. A341516 (a variant).

Programs

  • PARI
    A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); (t); };
    A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)};
    A156552(n) = { my(f = factor(n), p2 = 1, res = 0); for(i = 1, #f~, p = 1 << (primepi(f[i, 1]) - 1); res += (p * p2 * (2^(f[i, 2]) - 1)); p2 <<= f[i, 2]); res };
    A329603(n) = A005940(2+(3*A156552(n)));
    A341515(n) = if(n%2, A064989(n), A329603(n));

Formula

If n is odd, then a(n) = A064989(n), otherwise a(n) = A329603(n) = A341510(n,2*n).
a(n) = A005940(1+A006370(A156552(n))).

A074472 Length of iteration sequence of Collatz-function (A006370) when initial value is 3^n (A000244) and final cycle is followed once.

Original entry on oeis.org

1, 8, 20, 112, 23, 97, 34, 77, 76, 44, 136, 135, 134, 133, 145, 206, 130, 191, 141, 96, 95, 262, 429, 92, 259, 395, 332, 256, 255, 391, 390, 389, 463, 462, 461, 460, 459, 458, 457, 456, 455, 454, 502, 501, 451, 499, 498, 753, 496, 495, 494, 749, 492, 747, 490
Offset: 0

Views

Author

Labos Elemer, Sep 19 2002

Keywords

Examples

			n=2: initial value=3^2, list of iterates is {9,28,14,7,22,11,34,17,52,26,13,50,20,10,5,16,8,4,2,1} length=a(2)=20; Observe that consecutive powers of 3 as arguments frequently provide iteration-lengths of consecutive integers, for instance n=10,11,12,13 give L=136,135,134,133 or n=88-96 result in L=1278-1271.
		

Crossrefs

Programs

  • Mathematica
    f[x_] := (1-Mod[x, 2])*(x/2)+(Mod[x, 2])*(3*x+1); f[1]=1; Table[1+Length[FixedPointList[f, 3^w]], {w, 1, 100}]

A352892 Next even term in the trajectory of map x -> A341515(x), when starting from x=n; a(1) = 1. Here A341515 is the Collatz or 3x+1 map (A006370) conjugated by unary-binary-encoding (A156552).

Original entry on oeis.org

1, 2, 2, 6, 2, 2, 2, 12, 4, 8, 2, 14, 2, 18, 6, 24, 2, 6, 2, 54, 10, 50, 2, 28, 4, 98, 8, 150, 2, 2, 2, 48, 14, 242, 6, 70, 2, 338, 22, 108, 2, 8, 2, 294, 12, 578, 2, 56, 4, 20, 26, 726, 2, 12, 10, 300, 34, 722, 2, 26, 2, 1058, 20, 96, 14, 18, 2, 1014, 38, 32, 2, 140, 2, 1682, 18, 1734, 6, 50, 2, 216, 16, 1922, 2, 686
Offset: 1

Views

Author

Antti Karttunen, Apr 08 2022

Keywords

Crossrefs

Coincides with A353268 on even n, and with A348717 on odd n.

Programs

  • PARI
    A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); (t); };
    A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)};
    A156552(n) = { my(f = factor(n), p, p2 = 1, res = 0); for(i = 1, #f~, p = 1 << (primepi(f[i, 1]) - 1); res += (p * p2 * (2^(f[i, 2]) - 1)); p2 <<= f[i, 2]); res };
    A329603(n) = A005940(2+(3*A156552(n)));
    A341515(n) = if(n%2, A064989(n), A329603(n));
    A348717(n) = { my(f=factor(n)); if(#f~>0, my(pi1=primepi(f[1, 1])); for(k=1, #f~, f[k, 1] = prime(primepi(f[k, 1])-pi1+1))); factorback(f); }; \\ From A348717
    A352892(n) = A348717(A341515(n));
    
  • PARI
    A352892(n) = if(1==n, n, n = A341515(n); while(n%2, n = A341515(n)); (n)); \\ A slower alternative.

Formula

a(n) = A348717(A341515(n)).
For all n >= 1, a(2n) = A353268(2n), a(2n-1) = A348717(2n-1).
a(p) = 2 for all primes p.
For n > 1, a(n) = A005940(1+A139391(A156552(n))).

A075476 Number of iteration that first becomes smaller than the initial value if Collatz-function (A006370) is iterated, starting with numbers of form 64n+7. Corresponds to selection of every 16th term from A074474.

Original entry on oeis.org

12, 84, 12, 14, 12, 35, 12, 14, 12, 17, 12, 14, 12, 25, 12, 14, 12, 25, 12, 14, 12, 27, 12, 14, 12, 17, 12, 14, 12, 38, 12, 14, 12, 25, 12, 14, 12, 45, 12, 14, 12, 17, 12, 14, 12, 27, 12, 14, 12, 20, 12, 14, 12, 79, 12, 14, 12, 17, 12, 14, 12, 20, 12, 14, 12, 33, 12, 14, 12
Offset: 0

Views

Author

Labos Elemer, Sep 23 2002

Keywords

Comments

Remark that initial values of form 64m+r, if r={3, 11, 19, 27, 35, 43, 51, 55} provide first-sink-lengths {7, 9, 7, 9, 7, 9, 7, 9} respectively; e.g. {64k+19, 192k+58, 96k+29, 288k+88, 144k+44, 72k+22, 36k+11} submerge first below initial value at the 7th term, 36k+11<64k+19.

Examples

			n=0: 64n+7=7, list={7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5..}, i.e. the 12th term is the first that <12, the initial value.
		

Crossrefs

Programs

  • Mathematica
    lcoll[n_] := Length[NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # >= n &]]; Table[lcoll[64*i + 7], {i, 0, 68}] (* Jayanta Basu, Jun 15 2013 *)
  • PARI
    A006370(n) = if(n%2, 3*n+1, n/2);
    A074473(n) = if(1==n,n,my(org_n=n); for(i=1,oo,if(nA006370(n)));
    A075476(n) = A074473((64*n)+7); \\ Antti Karttunen, Oct 09 2018

Formula

a(n) = A074473(64n+7), n=0, ..., 256

Extensions

Typo in formula corrected by Antti Karttunen, Oct 09 2018

A074474 Number of iteration that first becomes smaller than the initial value if Collatz-function (A006370) is iterated, starting with numbers of form 4n+3.

Original entry on oeis.org

7, 12, 9, 12, 7, 9, 97, 92, 7, 14, 9, 89, 7, 9, 12, 89, 7, 84, 9, 14, 7, 9, 74, 14, 7, 69, 9, 51, 7, 9, 14, 25, 7, 12, 9, 12, 7, 9, 66, 35, 7, 48, 9, 14, 7, 9, 12, 22, 7, 14, 9, 22, 7, 9, 14, 51, 7, 20, 9, 33, 7, 9, 45, 22, 7, 12, 9, 12, 7, 9, 40, 17, 7, 14, 9, 22, 7, 9, 12, 35, 7, 35, 9, 14
Offset: 1

Views

Author

Labos Elemer, Sep 19 2002

Keywords

Examples

			n=6: 4n-1=23, the list={23,70,35,106,53,160,80,40,20, 10,5,16,8,4,2,1} sinks first below iv=23 at 20, the 9th term, so a(6)=9. Observe several (provable) modular rules with respect of initial value: e.g. regular appearance of 9 and 7.
		

Crossrefs

Programs

  • Mathematica
    Table[Function[k, Length@ NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, k, # >= k &]][4 n - 1], {n, 120}] (* Michael De Vlieger, Feb 20 2017 *)

Formula

a(n)=A074473[4n-1]

A075483 Number of iteration that first becomes smaller than the initial value if Collatz-function (A006370) is iterated, starting with numbers of form 64n+63.

Original entry on oeis.org

89, 25, 22, 22, 35, 20, 66, 30, 17, 38, 133, 27, 25, 40, 35, 30, 20, 25, 22, 38, 38, 133, 51, 27, 17, 40, 22, 30, 20, 35, 22, 95, 131, 33, 20, 25, 27, 22, 27, 66, 17, 27, 71, 45, 33, 48, 35, 89, 22, 33, 30, 30, 48, 22, 40, 30, 17, 61, 30, 64, 22, 22, 25, 84, 22, 22, 25, 33
Offset: 0

Views

Author

Labos Elemer, Sep 24 2002

Keywords

Comments

1stSubmergeLengths[=A074473] with initial values belonging to other residue classes modulo 64 are either listed in A075476-A075483 or can be easily determined. For 64k+2s the first sink below initial value is at 2nd iterate; for 64k+4s+1 the first submerge below initial value comes at 4th term of iteration list; finally if initial value is of 64k+4s+3 form or moreover initial value = 64k+r, r = 3, 11, 19, 23, 35, 43, 51, 55, then for all k first sink emerges at the 7th, 9th, 7th, 9th, 7th, 9th, 7th, 9th iterates, respectively.

Examples

			n=8: 64n + 63 = 575, the list = the 17th term 410 < 575 = initial value, so a(8)=17.
		

Crossrefs

Programs

  • Mathematica
    Table[Function[k, Length@ NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, k, # >= k &]][64 n - 1], {n, 120}] (* Michael De Vlieger, Feb 20 2017 *)

Formula

a(n) = A074473(64n + 63).

A075482 Number of iteration that first becomes smaller than the initial value if Collatz-function (A006370) is iterated, starting with numbers of the form 64n + 59.

Original entry on oeis.org

12, 14, 12, 45, 12, 14, 12, 17, 12, 14, 12, 33, 12, 14, 12, 20, 12, 14, 12, 25, 12, 14, 12, 17, 12, 14, 12, 20, 12, 14, 12, 30, 12, 14, 12, 25, 12, 14, 12, 17, 12, 14, 12, 30, 12, 14, 12, 22, 12, 14, 12, 69, 12, 14, 12, 17, 12, 14, 12, 22, 12, 14, 12, 22, 12, 14, 12, 82, 12
Offset: 0

Views

Author

Labos Elemer, Sep 24 2002

Keywords

Comments

1stSubmergeLengths[=A074473] with initial values belonging to other residue classes modulo 64 are either listed in A075476-A075483 or can be easily determined. For 64k+2s the first sink below initial value is at 2nd iterate; for 64k+4s+1 the first submerge below initial value comes at 4th term of iteration list; finally if initial value is of 64k+4s+3 form or moreover initial value = 64k+r, r = 3, 11, 19, 23, 35, 43, 51, 55, then for all k first sink emerges at the 7th, 9th, 7th, 9th, 7th, 9th, 7th, 9th iterates, respectively.

Examples

			n=0: 64n + 59 = 59, the list = {59,178,89,268,134,67,202,101,304,152,76,38,...} the 12th term = 38 < 59 = the initial value, so a(0)=12.
		

Crossrefs

Programs

  • Mathematica
    Table[Function[m, Length@ NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, m, # >= m - 1 &]][64 n + 59], {n, 0, 84}] (* Michael De Vlieger, Mar 25 2017 *)
  • PARI
    A006370(n) = if(n%2, 3*n+1, n/2);
    A074473(n) = if(1==n,n,my(org_n=n); for(i=1,oo,if(nA006370(n)));
    A075482(n) = A074473((64*n)+59); \\ Antti Karttunen, Oct 09 2018

Formula

a(n) = A074473(64n + 59).

A075484 Length of iteration-list when Collatz-function(A006370) is iterated with initial value 5^n.

Original entry on oeis.org

1, 6, 24, 109, 26, 124, 147, 139, 100, 92, 115, 337, 135, 277, 181, 261, 240, 219, 286, 322, 451, 337, 303, 432, 243, 540, 408, 444, 304, 464, 438, 554, 484, 582, 517, 677, 462, 617, 1002, 539, 655, 709, 714, 737, 623, 708, 868, 723, 707, 676, 642, 833, 776
Offset: 0

Views

Author

Labos Elemer, Sep 26 2002

Keywords

Examples

			n=2: 5^n=25, list={25, 76, 38, 19, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10.5, 16, 8, 4, 2, 1}, a(2)=24.
		

Crossrefs

Programs

  • Mathematica
    Table[Length[NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, 5^n, # != 1 &]], {n, 0, 52}] (* Michael De Vlieger, Feb 25 2017 *)

Formula

a(n) = A008908(5^n).

A352890 Number of iterations of map x -> A341515(x) needed to reach x <= 2 when starting from x=n, or -1 if such number is never reached. Here A341515 is the Collatz or 3x+1 map (A006370) conjugated by unary-binary-encoding (A156552).

Original entry on oeis.org

0, 0, 1, 7, 2, 5, 3, 16, 8, 19, 4, 14, 5, 12, 6, 17, 6, 9, 7, 20, 20, 26, 8, 15, 9, 27, 17, 13, 9, 7, 10, 106, 13, 121, 7, 111, 11, 122, 27, 34, 12, 21, 13, 27, 15, 35, 14, 104, 10, 23, 28, 28, 15, 18, 21, 102, 122, 36, 16, 29, 17, 156, 21, 107, 14, 14, 18, 122, 123, 109, 19, 112, 20, 113, 10, 123, 8, 28, 21, 35
Offset: 1

Views

Author

Antti Karttunen, Apr 08 2022

Keywords

Comments

The unbroken ray in the scatter plot corresponds to primes.

Crossrefs

Programs

  • PARI
    A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); (t); };
    A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)};
    A156552(n) = { my(f = factor(n), p, p2 = 1, res = 0); for(i = 1, #f~, p = 1 << (primepi(f[i, 1]) - 1); res += (p * p2 * (2^(f[i, 2]) - 1)); p2 <<= f[i, 2]); res };
    A329603(n) = A005940(2+(3*A156552(n)));
    A341515(n) = if(n%2, A064989(n), A329603(n));
    A352890(n) = { my(k=0); while(n>2, n = A341515(n); k++); (k); };

Formula

If n <= 2, a(n) = 0, otherwise a(n) = 1 + a(A341515(n)).
For n > 1, a(n) = A006577(A156552(n)).
For n >= 1, a(A000040(n)) = n-1.
For n >= 1, a(n) >= A352891(n).
For n >= 1, a(n) >= A352893(n).
Showing 1-10 of 221 results. Next