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

A126038 Index where n first appears in A128333, or -1 if n never appears.

Original entry on oeis.org

0, 1, 3, -1, 2, 15, -1, 4, 17, -1, 14, 6, -1, 11, 182, -1, 16, 8, -1, 21, 13, -1, 5, 145, -1, 18, 10, -1, 181, 23, -1, 349, 41, -1, 7, 147, -1, 178, 20, -1, 12, 346, -1, 183, 25, -1, 144, 56, -1, 188, 30, -1, 9, 149, -1, 48, 180, -1, 22, 317, -1, 141, 348, -1
Offset: 0

Views

Author

Nick Hobson, Feb 28 2007

Keywords

Comments

Positive multiples of 3 never appear in A128333. Does every other number eventually appear there?

Crossrefs

Cf. A128333.

A308712 a(0) = 0 and a(1) = 1; for n > 1, a(n) = a(n-1)/2 if that number is an integer and not already in the sequence, otherwise a(n) = 3*a(n-1) + remainder of a(n-1)/2. (A variant of the Collatz sequence).

Original entry on oeis.org

0, 1, 4, 2, 6, 3, 10, 5, 16, 8, 24, 12, 36, 18, 9, 28, 14, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 60, 30, 15, 46, 23, 70, 35, 106, 53, 160, 80, 240, 120, 360, 180, 90, 45, 136, 68, 204, 102, 51, 154, 77, 232, 116, 58, 29, 88, 44, 132, 66, 33, 100, 50, 25, 76, 38, 19, 58
Offset: 0

Views

Author

Keywords

Comments

Similar to A128333 and related to the 3x+1 (Collatz) sequence. Hits all positive integers?

Examples

			a(1)=1 => a(2)=3*1+1=4 because a(1) is odd => a(3)=4/2=2 because a(2) is even => a(4)=3*2+0=6 because a(3) is even but a(3)/2 is already in the sequence.
		

Crossrefs

Programs

  • Mathematica
    a[0] = 0; a[1] = 1; a[n_] := a[n] = With[{b = a[n-1]}, If[EvenQ[b] && FreeQ[Array[a, n, 0], b/2], b/2, 3 b + Mod[b, 2]]];
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Jun 20 2019 *)

A346035 a(1) = 1; if a(n) is not divisible by 3, a(n+1) = 4*a(n) + 1, otherwise a(n+1) = a(n)/3.

Original entry on oeis.org

1, 5, 21, 7, 29, 117, 39, 13, 53, 213, 71, 285, 95, 381, 127, 509, 2037, 679, 2717, 10869, 3623, 14493, 4831, 19325, 77301, 25767, 8589, 2863, 11453, 45813, 15271, 61085, 244341, 81447, 27149, 108597, 36199, 144797, 579189, 193063, 772253, 3089013, 1029671, 4118685
Offset: 1

Views

Author

Tristan Young, Jul 02 2021

Keywords

Crossrefs

Programs

  • Mathematica
    a[1] = 1; a[n_] := a[n] = If[Divisible[a[n-1],3], a[n-1]/3, 4*a[n-1]+1]; Array[a, 50] (* Amiram Eldar, Jul 12 2021 *)
  • PARI
    a(n) = if (n==1, 1, my(x=a(n-1)); if (x % 3, 4*x+1, x/3)); \\ Michel Marcus, Aug 12 2021
  • Processing
    // generates all the numbers in the sequence before it first surpasses 1 billion
    int n;
    void setup() {
      n = 1;
      noLoop();
    }
    void draw() {
      print(n + ",");
      while (true) {
        if (n % 3 == 0) {
          n /= 3;
        } else {
          n *= 4; n++;
        }
        print(n);
        if (n == 1 || n >= 600000000) {
          break;
        } else {
          print(", ");
        }
      }
    }
    
Showing 1-3 of 3 results.