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

A217934 Records in A102419.

Original entry on oeis.org

0, 1, 6, 11, 96, 132, 171, 220, 267, 269, 282, 287, 298, 365, 401, 468, 476, 486, 502, 613, 644, 649, 706, 729, 892, 897, 988, 1122, 1161, 1177, 1187, 1445, 1471, 1575, 1614, 1639
Offset: 1

Views

Author

N. J. A. Sloane, Oct 20 2012

Keywords

Comments

If the "1" is omitted, also records in A060445.

Examples

			See A102419.
		

Crossrefs

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

A060412 In the '3x+1' problem, these values for the starting value set new records for the "dropping time", number of steps to reach a lower value than the start.

Original entry on oeis.org

2, 3, 7, 27, 703, 10087, 35655, 270271, 362343, 381727, 626331, 1027431, 1126015, 8088063, 13421671, 20638335, 26716671, 56924955, 63728127, 217740015, 1200991791, 1827397567, 2788008987, 12235060455
Offset: 1

Views

Author

N. J. A. Sloane, Apr 06 2001; b-file added Nov 27 2007

Keywords

Comments

The (3x+1)/2 steps and the halving steps are counted. - Don Reble, May 13 2006
Where records occur in A102419 (could be prefixed by an initial 1). - N. J. A. Sloane, Oct 20 2012

Examples

			See A102419.
		

Crossrefs

A060413 gives associated "dropping times", A060414 the maximal values and A060415 the steps at which the maxima occur. See also A217934.

Programs

  • Mathematica
    dcoll[n_]:=Length[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>=n&]]; t={max=2}; Do[If[(y=dcoll[n])>max,max=y; AppendTo[t,n]],{n,3,1130000,4}]; t (* Jayanta Basu, May 28 2013 *)

A126241 Dropping times in the 3n+1 problem (or the Collatz problem). Let T(n):=n/2 if n is even, (3n+1)/2 otherwise (A014682). Let a(n) be the smallest integer k such that T^(k)(n)

Original entry on oeis.org

0, 1, 4, 1, 2, 1, 7, 1, 2, 1, 5, 1, 2, 1, 7, 1, 2, 1, 4, 1, 2, 1, 5, 1, 2, 1, 59, 1, 2, 1, 56, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 5, 1, 2, 1, 54, 1, 2, 1, 4, 1, 2, 1, 5, 1, 2, 1, 7, 1, 2, 1, 54, 1, 2, 1, 4, 1, 2, 1, 51, 1, 2, 1, 5, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 5, 1, 2, 1, 45, 1, 2, 1, 8, 1, 2, 1, 4
Offset: 1

Views

Author

Christof Menzel (christof.menzel(AT)hs-niederrhein.de), Mar 08 2007

Keywords

Comments

Also called "stopping times", although that term is usually reserved for A006666.
From K. Spage, Oct 22 2009, corrected Aug 21 2014: (Start)
Congruency relationship: For n>1 and m>1, all m congruent to n mod 2^(a(n)) have a dropping time equal to a(n).
By refining the definition of the dropping time to "starting with x=n, iterate x until (abs(x) <= abs(n))" the above congruency relationship holds for all nonnegative values of n and all positive or negative values of m including zero.
By this refined definition, a(1)=2 rather than the usual zero set by convention. All other values of positive a(n) remain unchanged. (End)
Terras defines a coefficient stopping time (definition 1.5) tau(n) = d which is the smallest d for which 3^u/2^d < 1 where u is the number of tripling steps among the first d steps starting from n. Clearly tau(n) <= a(n), and Terras conjectures (conjecture 2.9) that tau(n) = a(n) for n>=2. - Olivier Rozier, May 13 2024

Examples

			s(15) = 7, since the trajectory {T^(k)(15)} (k=1,2,3,...) equals 23,35,53,80,40,20,10.
		

References

  • J. C. Lagarias, ed., The Ultimate Challenge: The 3x+1 Problem, Amer. Math. Soc., 2010. See p. 33.

Crossrefs

See A074473, which is the main entry for dropping times.
Records: A060412, A060413.
Cf. A020914 (allowable dropping times). - K. Spage, Aug 22 2014

Programs

  • Mathematica
    Collatz2[n_] := If[n<2, {}, Rest[NestWhileList[If[EvenQ[#], #/2, (3 # + 1)/2] &, n, # >= n &]]]; Table[Length[Collatz2[n]], {n, 1, 1000}]

Formula

a(n) = ceiling(A102419(n)/(1+log(2)/log(3))). - K. Spage, Aug 22 2014

Extensions

Broken link fixed by K. Spage, Oct 22 2009

A060445 "Dropping time" in 3x+1 problem starting at 2n+1 (number of steps to reach a lower number than starting value). Also called glide(2n+1).

Original entry on oeis.org

0, 6, 3, 11, 3, 8, 3, 11, 3, 6, 3, 8, 3, 96, 3, 91, 3, 6, 3, 13, 3, 8, 3, 88, 3, 6, 3, 8, 3, 11, 3, 88, 3, 6, 3, 83, 3, 8, 3, 13, 3, 6, 3, 8, 3, 73, 3, 13, 3, 6, 3, 68, 3, 8, 3, 50, 3, 6, 3, 8, 3, 13, 3, 24, 3, 6, 3, 11, 3, 8, 3, 11, 3, 6, 3, 8, 3, 65, 3, 34, 3, 6, 3, 47, 3, 8, 3, 13, 3, 6, 3, 8, 3
Offset: 0

Views

Author

N. J. A. Sloane, Apr 07 2001

Keywords

Comments

If the starting value is even then of course the next step in the trajectory is smaller (cf. A102419).
The dropping time can be made arbitrarily large: If the starting value is of form n(2^m)-1 and m > 1, the next value is 3n(2^m)-3+1. That divided by 2 is 3n(2^(m-1))-1. It is bigger than the starting value and of the same form - substitute 3n -> n and m-1 -> m, so recursively get an increasing subsequence of m odd values. The dropping time is obviously longer than that. This holds even if Collatz conjecture were refuted. For example, m=5, n=3 -> 95, 286, 143, 430, 215, 646, 323, 970, 485, 1456, 728, 364, 182, 91. So the subsequence in reduced Collatz variant is 95, 143, 215, 323, 485. - Juhani Heino, Jul 21 2017

Examples

			3 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2, taking 6 steps, so a(1) = 6.
		

Crossrefs

A060565 gives the first lower number that is reached. Cf. A060412-A060415, A217934.
See A074473, A102419 for other versions of this sequence.
Cf. A122437 (allowable dropping times), A122442 (least k having dropping time A122437(n)).
Cf. A070165.

Programs

  • Haskell
    a060445 0 = 0
    a060445 n = length $ takeWhile (>= n') $ a070165_row n'
                where n' = 2 * n + 1
    -- Reinhard Zumkeller, Mar 11 2013
    
  • Mathematica
    nxt[n_]:=If[OddQ[n],3n+1,n/2]; Join[{0},Table[Length[NestWhileList[nxt, n,#>=n&]]-1, {n,3,191,2}]]  (* Harvey P. Dale, Apr 23 2011 *)
  • Python
    def a(n):
        if n<1: return 0
        n=2*n + 1
        N=n
        x=0
        while True:
            if n%2==0: n//=2
            else: n = 3*n + 1
            x+=1
            if nIndranil Ghosh, Apr 22 2017

Extensions

More terms from Jason Earls, Apr 08 2001 and from Michel ten Voorde Apr 09 2001
Still more terms from Larry Reeves (larryr(AT)acm.org), Apr 12 2001

A352891 Number of iterations of map x -> A341515(x) needed to reach x < n when starting from x=n, or 0 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, 6, 1, 3, 1, 11, 1, 3, 1, 9, 1, 7, 1, 11, 1, 3, 1, 6, 1, 6, 1, 9, 1, 11, 1, 7, 1, 1, 1, 91, 1, 106, 1, 5, 1, 16, 1, 14, 1, 4, 1, 7, 1, 20, 1, 89, 1, 3, 1, 7, 1, 3, 1, 87, 1, 21, 1, 1, 1, 50, 1, 92, 1, 5, 1, 18, 1, 3, 1, 8, 1, 98, 1, 14, 1, 5, 1, 14, 1, 34, 1, 6, 1, 35, 1, 12, 1, 2, 1, 21, 1, 71, 1, 90, 1, 3
Offset: 1

Views

Author

Antti Karttunen, Apr 08 2022

Keywords

Comments

This is one possible analog for A102419 ("Dropping time" sequence) when computed for A341515. See also A352894.

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));
    A352891(n) = if(n<=2, 0, my(k=0,x=n); while(x>=n, x = A341515(x); k++); (k));

Formula

For n >= 1, a(2n+1) = 1.
For n >= 1, A352894(n) <= a(n) <= A352890(n).

A290101 a(n) = dropping time for the modified Collatz problem, where x -> 3x+1 if x is odd, and x -> either x/2 or 3x+1 if x is even (minimal number of any such steps to reach a lower number than the starting value n); a(1) = 0 by convention.

Original entry on oeis.org

0, 1, 6, 1, 3, 1, 11, 1, 3, 1, 8, 1, 3, 1, 11, 1, 3, 1, 6, 1, 3, 1, 8, 1, 3, 1, 16, 1, 3, 1, 19, 1, 3, 1, 6, 1, 3, 1, 11, 1, 3, 1, 8, 1, 3, 1, 16, 1, 3, 1, 6, 1, 3, 1, 8, 1, 3, 1, 11, 1, 3, 1, 19, 1, 3, 1, 6, 1, 3, 1, 13, 1, 3, 1, 8, 1, 3, 1, 13, 1, 3, 1, 6, 1, 3, 1, 8, 1, 3, 1, 11, 1, 3, 1, 13, 1, 3, 1, 6, 1, 3, 1, 16, 1, 3, 1, 8, 1, 3
Offset: 1

Views

Author

Antti Karttunen, Aug 20 2017

Keywords

Comments

In contrast to the "3x+1" problem (see A006577, A102419), here you are free to choose either step if x is even. The sequence counts the minimum number of optimally chosen steps which leads to a value smaller than the value we started from.

Examples

			Starting from n = 27, the following is a shortest path leading to a value smaller than 27: 27 -> 82 -> 41 -> 124 -> 373 -> 1120 -> 560 -> 280 -> 140 -> 70 -> 35 -> 106 -> 53 -> 160 -> 80 -> 40 -> 20. It has 16 steps, thus a(27) = 16. Note the 3x+1 step from 124 to 373 which is not allowed in the ordinary Collatz problem.
		

Crossrefs

Cf. A127885, A290100, A290102, A000012 (even bisection).
Differs from A102419 for the first time at n=27, where a(27) = 16, while A102419(27) = 96.

Programs

  • PARI
    A290101(n) = { if(1==n,return(0)); my(S, k); S=[n]; k=0; while( S[1]>=n, k++; S=vecsort( concat(apply(x->3*x+1, S), apply(x->x\2, select(x->x%2==0, S) )), , 8);  ); k } \\ After Max Alekseyev's code for A127885
    
  • Python
    from sympy import flatten
    def ok(n, L):
        return any(i < n for i in L)
    def a(n):
        if n==1: return 0
        L=[n]
        i = 0
        while not ok(n, L):
            L=set(flatten([[3*k + 1, k//2] if k%2==0 else 3*k + 1 for k in L]))
            i+=1
        return i
    print([a(n) for n in range(1, 121)]) # Indranil Ghosh, Aug 31 2017

Formula

a(n) <= A102419(n).
a(n) <= A127885(n) [apart from any hypothetical -1's in A127885].

A318489 Number of steps to reach a lower number than starting value in 7x+-1 problem, or 0 if never reached.

Original entry on oeis.org

0, 1, 12, 1, 8, 1, 4, 1, 4, 1, 42, 1, 8, 1, 4, 1, 4, 1, 23, 1, 20, 1, 4, 1, 4, 1, 12, 1, 16, 1, 4, 1, 4, 1, 282, 1, 12, 1, 4, 1, 4, 1, 229, 1, 50, 1, 4, 1, 4, 1, 8, 1, 35, 1, 4, 1, 4, 1, 8, 1, 50, 1, 4, 1, 4, 1, 46, 1, 8, 1, 4, 1, 4, 1, 225, 1, 8, 1, 4, 1, 4, 1, 35, 1, 16, 1, 4, 1, 4, 1, 46, 1, 27, 1, 4, 1, 4, 1, 16
Offset: 1

Views

Author

David Barina, Aug 27 2018

Keywords

Comments

The least positive k for which the iterate A317640^k(n) < n.
Also called the dropping time, glide, or stopping time.
a(2n) = 1.

Examples

			a(5) = 8 because the trajectory is (5, 36, 18, 9, 64, 32, 16, 8, 4, 2, 1, ...) and the first lower number is 4. Thus 8 steps to reach the value 4 starting from the value 5.
		

Crossrefs

Cf. A317640 (7x+-1 function), A102419 (3x+1 equivalent).

Programs

  • C
    int a(int n0) {
            if( n0 == 1 ) return 0;
            int s = 0;
            for(int n = n0; n >= n0; s++) {
                    switch(n%4) {
                            case 1: n = 7*n+1; break;
                            case 3: n = 7*n-1; break;
                            default: n = n/2;
                    }
            }
            return s;
    }
    
  • PARI
    a7(n) = {my(m=(n+2)%4-2); if(m%2, 7*n + m, n/2)};
    a(n) = if (n==1, 0, my(nb=1, m=n, nm); while((nm=a7(m)) >= n, m = nm; nb++); nb); \\ Michel Marcus, Aug 28 2018
Showing 1-8 of 8 results.