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.

A271623 a(0)=7; a(n) = 7*a(n-1) + 1 if a(n-1) is odd, a(n) = a(n-1)/2 otherwise.

Original entry on oeis.org

7, 50, 25, 176, 88, 44, 22, 11, 78, 39, 274, 137, 960, 480, 240, 120, 60, 30, 15, 106, 53, 372, 186, 93, 652, 326, 163, 1142, 571, 3998, 1999, 13994, 6997, 48980, 24490, 12245, 85716, 42858, 21429, 150004, 75002, 37501, 262508, 131254, 65627, 459390, 229695
Offset: 0

Views

Author

Vincenzo Librandi, Apr 11 2016

Keywords

Comments

Conjectured: No term of the sequence is equal to a previous term.

Examples

			7 is odd, so it is followed by 7*7 + 1 = 50.
50 is even, so it is followed by 50/2 = 25.
		

Crossrefs

Programs

  • Magma
    [n eq 1 select 7 else IsOdd(Self(n-1)) select 7*Self(n-1)+1 else Self(n-1) div 2: n in [1..60]];
    
  • Mathematica
    NestList[If[EvenQ[#], #/2, 7 # + 1]&, 7, 60]
  • PARI
    Collatz(n, lim=0) = {my(c=n, e=0, L=List(n)); if(lim==0, e=1; lim=n*10^2);
    for(i=1, lim, if(c%2==0, c=c/2, c=7*c+1); listput(L, c); if(e&&c==1, break)); return(Vec(L));}
    print(Collatz(7)) \\ Adapted from A008884 \\ Altug Alkan, Apr 11 2016