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

A128333 a(0) = 0; for n > 0, 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) + 1.

Original entry on oeis.org

0, 1, 4, 2, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 25, 76, 38, 19, 58, 29, 88, 44, 133, 400, 200, 100, 50, 151, 454, 227, 682, 341, 1024, 512, 256, 128, 64, 32, 97, 292, 146, 73, 220, 110, 55, 166, 83, 250, 125, 376, 188, 94, 47, 142, 71, 214, 107, 322, 161
Offset: 0

Views

Author

Nick Hobson, Feb 27 2007

Keywords

Comments

Other than a(0) = 0, the sequence misses all multiples of 3. Does it eventually hit all positive non-multiples of 3?

Examples

			Consider n = 3. We have a(3) = 2 and try to divide by 2. The result, 1, is certainly an integer, but we cannot use it because 1 is already in the sequence. So we must multiply by 3 and add 1 instead, getting a(4) = 3*2 + 1 = 7.
		

Crossrefs

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 *)
Showing 1-2 of 2 results.