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 60 results. Next

A087251 Distinct largest-peak-values in 3x+1 trajectory arranged by their first appearance as initial value increases. A025586 without repetitions while keeping order.

Original entry on oeis.org

1, 2, 16, 4, 52, 8, 40, 160, 88, 20, 64, 24, 9232, 32, 100, 112, 304, 196, 136, 48, 148, 232, 56, 184, 68, 208, 72, 340, 808, 80, 244, 84, 256, 592, 280, 96, 448, 104, 520, 116, 352, 628, 4372, 128, 132, 400, 916, 424, 144, 1024, 152, 472, 736, 168, 176, 532, 180
Offset: 1

Views

Author

Labos Elemer, Sep 08 2003

Keywords

Examples

			peak=160 appears in trajectory started with n=15 and
before peaks = 1,2,16,4,52,8,40 appear at n=1,..,14
initial values: 160=a(8), the 8th new peak-value.
		

Crossrefs

Cf. A025586.

A087260 a(n) = gcd(4n, A025586(4n)), greatest common divisor of 4n and largest value in 3x+1 iteration list started at 4n.

Original entry on oeis.org

4, 8, 4, 16, 20, 24, 4, 32, 4, 40, 4, 48, 52, 56, 20, 64, 68, 72, 4, 80, 84, 88, 4, 96, 100, 104, 4, 112, 116, 40, 4, 128, 132, 136, 20, 144, 148, 152, 4, 160, 4, 168, 4, 176, 180, 184, 4, 192, 196, 200, 4, 208, 212, 8, 4, 224, 228, 232, 4, 240, 244, 8, 4, 256, 260, 264
Offset: 1

Views

Author

Labos Elemer, Sep 09 2003

Keywords

Crossrefs

Programs

  • Mathematica
    c[x_] := (1-Mod[x, 2])*(x/2)+Mod[x, 2]*(3*x+1)c[1]=1; fpl[x_] := Delete[FixedPointList[c, x], -1] Table[GCD[4*w, Max[fpl[4*w]]], {w, 1, 256}]

A087261 a(n) = lcm(4n, A025586(4n)), least common multiple of 4n and the largest value in 3x+1 iteration list started at 4n.

Original entry on oeis.org

4, 8, 48, 16, 20, 24, 364, 32, 468, 40, 572, 48, 52, 56, 480, 64, 68, 72, 1672, 80, 84, 88, 3680, 96, 100, 104, 249264, 112, 116, 480, 286192, 128, 132, 136, 1120, 144, 148, 152, 11856, 160, 378512, 168, 8428, 176, 180, 184, 433904, 192, 196, 200, 11832, 208, 212
Offset: 1

Views

Author

Labos Elemer, Sep 09 2003

Keywords

Crossrefs

Programs

  • Mathematica
    c[x_] := (1-Mod[x, 2])*(x/2)+Mod[x, 2]*(3*x+1)c[1]=1; fpl[x_] := Delete[FixedPointList[c, x], -1] Table[LCM[4*w, Max[fpl[4*w]]], {w, 1, 256}]

A087258 a(n) = gcd(n, A025586(n)), greatest common divisor of n and largest value in 3x+1 iteration list started at n.

Original entry on oeis.org

1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 5, 16, 1, 2, 1, 20, 1, 2, 1, 24, 1, 2, 1, 4, 1, 10, 1, 32, 1, 2, 5, 4, 1, 2, 1, 40, 1, 2, 1, 4, 1, 2, 1, 48, 1, 2, 1, 52, 1, 2, 1, 56, 1, 2, 1, 20, 1, 2, 1, 64, 1, 2, 1, 68, 1, 10, 1, 72, 1, 2, 5, 4, 1, 2, 1, 80, 1, 2, 1, 84, 1, 2, 1, 88, 1, 2, 1, 4, 1, 2, 1, 96, 1
Offset: 1

Views

Author

Labos Elemer, Sep 09 2003

Keywords

Crossrefs

Programs

  • Mathematica
    c[x_] := (1-Mod[x, 2])*(x/2)+Mod[x, 2]*(3*x+1)c[1]=1; fpl[x_] := Delete[FixedPointList[c, x], -1] Table[GCD[w, Max[fpl[w]]], {w, 1, 256}]
  • PARI
    A025586(n) = { my(r=n); while(n>2, if(n%2, n=3*n+1; if(n>r, r=n), n/=2)); (r); }; \\ From A025586
    A087258(n) = gcd(n,A025586(n)); \\ Antti Karttunen, Dec 05 2018

A087259 a(n) = lcm(n, A025586(n)), least common multiple of n and largest value in 3x+1 iteration list started at n.

Original entry on oeis.org

1, 2, 48, 4, 80, 48, 364, 8, 468, 80, 572, 48, 520, 364, 480, 16, 884, 468, 1672, 20, 1344, 572, 3680, 24, 2200, 520, 249264, 364, 2552, 480, 286192, 32, 3300, 884, 1120, 468, 4144, 1672, 11856, 40, 378512, 1344, 8428, 572, 6120, 3680, 433904, 48, 7252, 2200
Offset: 1

Views

Author

Labos Elemer, Sep 09 2003

Keywords

Crossrefs

Programs

  • Mathematica
    c[x_] := (1-Mod[x, 2])*(x/2)+Mod[x, 2]*(3*x+1)c[1]=1; fpl[x_] := Delete[FixedPointList[c, x], -1] Table[LCM[w, Max[fpl[w]]], {w, 1, 256}]

A087976 a(n) = A001221(A025586(n)), the number of distinct prime-factors of maximal term in 3x+1 iteration list started at n.

Original entry on oeis.org

0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
Offset: 1

Views

Author

Labos Elemer, Sep 25 2003

Keywords

Crossrefs

Programs

  • Mathematica
    Collatz[a0_Integer, maxits_: 1000] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, a0, Unequal[#, 1, -1, -10, -34] &, 1, maxits]; (*Collatz[n] function definition by Eric Weisstein*) A025586[m_] :=
    Flatten[Table[Take[Sort[Collatz[n], Greater], 1], {n, m}]];
    PrimeNu[A025586[100]] (* G. C. Greubel, Apr 24 2017 *)

A275109 Number of times each term of the sequence A025586 (largest value in Collatz trajectory of n) occurs.

Original entry on oeis.org

1, 1, 1, 1, 6, 1, 1, 1, 3, 1, 12, 1, 3, 1, 1, 1, 1, 8, 1, 3, 1, 3, 1, 1, 1, 3, 1, 3, 1, 13, 1, 1, 1, 3, 1, 8, 1, 3, 1, 1, 1, 6, 1, 3, 3, 1, 1, 1, 1, 3, 1, 1, 14, 1, 1, 1, 1, 1, 6, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 3, 6, 1, 1, 1, 1, 3, 1, 1, 1, 8, 1, 3, 1, 3
Offset: 1

Views

Author

Jaroslav Krizek, Jul 16 2016

Keywords

Comments

The possible values of the sequence A025586 are in A033496. Value A033496(n) occurs exactly a(n) times.

Examples

			a(5) = 6 because there is 6 numbers m such that A025586(m) = A033496(5) = 16: 3, 5, 6, 10, 12 and 16.
See A095387; there is 1579 numbers m such that A025586(m) = 9232 = A033496(940); a(940) = 1579.
		

Crossrefs

A328147 a(n) = A025586(n)/4 for n>=3.

Original entry on oeis.org

4, 1, 4, 4, 13, 2, 13, 4, 13, 4, 10, 13, 40, 4, 13, 13, 22, 5, 16, 13, 40, 6, 22, 10, 2308, 13, 22, 40, 2308, 8, 25, 13, 40, 13, 28, 22, 76, 10, 2308, 16, 49, 13, 34, 40, 2308, 12, 37, 22, 58, 13, 40, 2308, 2308, 14, 49, 22, 76, 40, 46, 2308, 2308, 16, 49, 25, 76, 17, 52, 40, 2308, 18, 2308, 28, 85, 22, 58, 76, 202, 20, 61, 2308, 2308, 21, 64, 49, 148, 22, 76, 34, 2308, 40, 70, 2308, 2308, 24, 2308, 37, 112
Offset: 3

Views

Author

P. Michael Hutchins, Oct 22 2019

Keywords

Comments

This sequence factors out the 4 that all of the terms of A025586 for n>2 are divisible by.

Examples

			For n=3, the Collatz sequence is 3,10,5,16,8,4,2,1. The largest term is 16, so a(3) = 16/4 = 4.
		

Crossrefs

Cf. A025586.

Programs

  • Python
    def a(n):
        if n<3: return 0
        l=[n, ]
        while True:
            if n%2==0: n/=2
            else: n = 3*n + 1
            if not n in l:
                l+=[n, ]
                if n<2: break
            else: break
        return max(l)/4

Extensions

a(1)-a(2) removed from data by Michel Marcus, Nov 02 2020

A328314 Lexicographically earliest infinite sequence such that a(i) = a(j) => A025586(i) = A025586(j) for all i, j.

Original entry on oeis.org

1, 2, 3, 4, 3, 3, 5, 6, 5, 3, 5, 3, 7, 5, 8, 3, 5, 5, 9, 10, 11, 5, 8, 12, 9, 7, 13, 5, 9, 8, 13, 14, 15, 5, 8, 5, 16, 9, 17, 7, 13, 11, 18, 5, 19, 8, 13, 20, 21, 9, 22, 5, 8, 13, 13, 23, 18, 9, 17, 8, 24, 13, 13, 11, 18, 15, 17, 25, 26, 8, 13, 27, 13, 16, 28, 9, 22, 17, 29, 30, 31, 13, 13, 32, 33, 18, 34, 9, 17, 19, 13, 8, 35
Offset: 1

Views

Author

Antti Karttunen, Oct 14 2019

Keywords

Comments

Restricted growth sequence transform of A025586, the largest value in '3x+1' trajectory of n.

Crossrefs

Cf. A025586.
Cf. also A322973.

Programs

  • PARI
    up_to = 65537;
    rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om,invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om,invec[i],i); outvec[i] = u; u++ )); outvec; };
    A025586(n) = { my(r=n); while(n>2, if(n%2, n=3*n+1; if(n>r, r=n), n/=2)); (r); }; \\ From A025586
    v328314 = rgs_transform(vector(up_to, n, A025586(n)));
    A328314(n) = v328314[n];

A006577 Number of halving and tripling steps to reach 1 in '3x+1' problem, or -1 if 1 is never reached.

Original entry on oeis.org

0, 1, 7, 2, 5, 8, 16, 3, 19, 6, 14, 9, 9, 17, 17, 4, 12, 20, 20, 7, 7, 15, 15, 10, 23, 10, 111, 18, 18, 18, 106, 5, 26, 13, 13, 21, 21, 21, 34, 8, 109, 8, 29, 16, 16, 16, 104, 11, 24, 24, 24, 11, 11, 112, 112, 19, 32, 19, 32, 19, 19, 107, 107, 6, 27, 27, 27, 14, 14, 14, 102, 22
Offset: 1

Views

Author

Keywords

Comments

The 3x+1 or Collatz problem is as follows: start with any number n. If n is even, divide it by 2, otherwise multiply it by 3 and add 1. Do we always reach 1? This is a famous unsolved problem. It is conjectured that the answer is yes.
It seems that about half of the terms satisfy a(i) = a(i+1). For example, up to 10000000, 4964705 terms satisfy this condition.
n is an element of row a(n) in triangle A127824. - Reinhard Zumkeller, Oct 03 2012
The number of terms that satisfy a(i) = a(i+1) for i being a power of ten from 10^1 through 10^10 are: 0, 31, 365, 4161, 45022, 477245, 4964705, 51242281, 526051204, 5378743993. - John Mason, Mar 02 2018
5 seems to be the only number whose value matches its total number of steps (checked to n <= 10^9). - Peter Woodward, Feb 15 2021

Examples

			a(5)=5 because the trajectory of 5 is (5,16,8,4,2,1).
		

References

  • R. K. Guy, Unsolved Problems in Number Theory, E16.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

See A070165 for triangle giving trajectories of n = 1, 2, 3, ....

Programs

  • Haskell
    import Data.List (findIndex)
    import Data.Maybe (fromJust)
    a006577 n = fromJust $ findIndex (n `elem`) a127824_tabf
    -- Reinhard Zumkeller, Oct 04 2012, Aug 30 2012
    
  • Maple
    A006577 := proc(n)
            local a,traj ;
            a := 0 ;
            traj := n ;
            while traj > 1 do
                    if type(traj,'even') then
                            traj := traj/2 ;
                    else
                            traj := 3*traj+1 ;
                    end if;
                    a := a+1 ;
            end do:
            return a;
    end proc: # R. J. Mathar, Jul 08 2012
  • Mathematica
    f[n_] := Module[{a=n,k=0}, While[a!=1, k++; If[EvenQ[a], a=a/2, a=a*3+1]]; k]; Table[f[n],{n,4!}] (* Vladimir Joseph Stephan Orlovsky, Jan 08 2011 *)
    Table[Length[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#!=1&]]-1,{n,80}] (* Harvey P. Dale, May 21 2012 *)
  • PARI
    a(n)=if(n<0,0,s=n; c=0; while(s>1,s=if(s%2,3*s+1,s/2); c++); c)
    
  • PARI
    step(n)=if(n%2,3*n+1,n/2);
    A006577(n)=if(n==1,0,A006577(step(n))+1); \\ Michael B. Porter, Jun 05 2010
    
  • Python
    def a(n):
        if n==1: return 0
        x=0
        while True:
            if n%2==0: n//=2
            else: n = 3*n + 1
            x+=1
            if n<2: break
        return x
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jun 05 2017
    
  • Python
    def A006577(n):
        ct = 0
        while n != 1: n = A006370(n); ct += 1
        return ct # Ya-Ping Lu, Feb 22 2024
    
  • R
    collatz<-function(n) ifelse(n==1,0,1+ifelse(n%%2==0,collatz(n/2),collatz(3*n+1))); sapply(1:72, collatz) # Christian N. K. Anderson, Oct 09 2024

Formula

a(n) = A006666(n) + A006667(n).
a(n) = A112695(n) + 2 for n > 2. - Reinhard Zumkeller, Apr 18 2008
a(n) = A008908(n) - 1. - L. Edson Jeffery, Jul 21 2014
a(n) = A135282(n) + A208981(n) (after Alonso del Arte's comment in A208981), if 1 is reached, otherwise a(n) = -1. - Omar E. Pol, Apr 10 2022
a(n) = 2*A007814(n + 1) + a(A085062(n)) + 1 for n > 1. - Wing-Yin Tang, Jan 06 2025

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Apr 27 2001
"Escape clause" added to definition by N. J. A. Sloane, Jun 06 2017
Showing 1-10 of 60 results. Next