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

A359215 Number of terms in S(n) that did not appear in previous trajectories, where S(n) is the trajectory of the mappings of x->A359194(x) starting with n and stopping when 0 is reached, -1 if 0 is never reached.

Original entry on oeis.org

0, 1, 1, 11, 1, 1, 0, 2, 1, 1, 0, 6, 78, 0, 2, 0, 0, 1, 0, 1, 1, 0, 0, 3, 0, 0, 11, 0, 7571, 2, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 3, 0, 3, 77, 0, 5419, 1, 0, 1, 4, 0, 1, 0, 0, 2, 2, 0, 2, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1
Offset: 0

Views

Author

Michael De Vlieger, Dec 21 2022

Keywords

Comments

"Branch length" of n->A359194(n).
a(0) = 0 since n = 0.
Let m be the first term in S(n) that has appeared in S(k), k < n. A359218(n) = m.
Analogous to A222118 which instead regards the Collatz function A006318.

Examples

			a(0) = 0 since n = 0.
a(1) = 1 since S(1) = {1, 0}, but m = 0 appeared in S(0).
a(2) = 1 since S(2) = {2, 1, 0}, but m = 1 appeared in S(1).
a(3) = 11 since S(3) = {3, 6, 13, 24, 55, 90, 241, 300, 123, 142, 85, 0}, but m = 0 appeared in S(0).
a(4) = 1 since S(4) = {4, 3, ...} but 3 appears in S(3), etc.
		

Crossrefs

Programs

  • Mathematica
    c[] = -1; c[0] = 0; f[n] := FromDigits[BitXor[1, IntegerDigits[3*n, 2]], 2]; Table[(Map[If[c[#1] == -1, Set[c[#1], #2]] & @@ # &, Partition[#, 2, 1]]; -1 + Length[#]) &@ NestWhileList[f, n, c[#] == -1 &], {n, 0, 120}]

A263716 Irregular triangle read by rows: numbers in the Collatz conjecture in the order of their first appearance.

Original entry on oeis.org

1, 2, 3, 10, 5, 16, 8, 4, 6, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 9, 28, 14, 12, 15, 46, 23, 70, 35, 106, 53, 160, 80, 18, 19, 58, 29, 88, 44, 21, 64, 32, 24, 25, 76, 38, 27, 82, 41, 124, 62, 31, 94, 47, 142, 71, 214, 107, 322, 161, 484, 242, 121, 364, 182
Offset: 0

Views

Author

Daniel Suteu, Oct 24 2015

Keywords

Comments

This is the irregular triangle read by rows giving trajectory of n in the Collatz problem, flattened and with all the repeated terms deleted.
This sequence goes to infinity as n gets larger. On the Collatz conjecture this sequence is a permutation of the positive integers. [Corrected by Charles R Greathouse IV, Jul 29 2016]

Examples

			Triangle begins:
1;
2;
3, 10, 5, 16, 8, 4;
...
The Collatz trajectories for the first five positive integers are {1}, {2, 1}, {3, 10, 5, 16, 8, 4, 2, 1}, {4, 2, 1}, {5, 16, 8, 4, 2, 1}.
From {2, 1} we delete 1 because it has already occurred. From {3, 10, 5, ..., 4, 2, 1} we delete {2, 1} because both numbers have already occurred. We completely get rid of {4, 2, 1} because it has already occurred as the tail end of {3, 10, 5, ...}, and we also completely get rid of {5, 16, 8, ...} for the same reason.
This leaves us with {1}, {2}, {3, 10, 5, 16, 8, 4}, thus accounting for the first eight terms of this sequence.
		

Crossrefs

Cf. A006577, A070165, A222118 (row lengths).
Cf. A347265 (essentially the same).

Programs

  • Mathematica
    collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; DeleteDuplicates[Flatten[Table[collatz[n], {n, 20}]]] (* Alonso del Arte, Oct 24 2015 *)
  • Sidef
    func collatz(n) is cached {  # automatically memoized function
        say n;                   # prints the first unseen numbers
        n.is_one ? 0
                 : (n.is_even ? collatz(n/2)
                              : collatz(3*n + 1));
    }
    range(1, Math.inf).each { |i| collatz(i) }

Formula

row(n) = {
if seen[n]: stop
else: write(n) and do:
| n is one: stop
| n is odd: n <- 3*n+1
| n is even: n <- n/2
}

A221956 Number of values in the Collatz (3x+1) trajectory starting at n that are also present in the trajectory for some k < n.

Original entry on oeis.org

0, 1, 2, 3, 6, 8, 7, 4, 17, 7, 15, 9, 10, 18, 9, 5, 13, 20, 16, 8, 5, 16, 16, 10, 21, 11, 17, 19, 19, 18, 107, 6, 24, 14, 14, 21, 19, 22, 23, 9, 110, 8, 22, 17, 14, 17, 105, 11, 25, 25, 20, 12, 12, 112, 106, 20, 30, 20, 33, 19, 20, 108, 95, 7, 28, 27, 28, 15, 12
Offset: 1

Views

Author

Michel Lagneau, Feb 23 2013

Keywords

Examples

			a(15) = 9 because the Collatz trajectory starting at 15 is (15, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1), which has 9 values, namely, 40, 20, 10, 5, 16, 8, 4, 2, and 1, in common with the trajectory for at least one k < 15.
		

Crossrefs

Programs

  • Maple
    lst1:={1}: L:={1}:for n from 2 to 200 do: x := n :lst:={n}:while x > 1 do if type(x, 'even') then x := x/2:lst:=lst union {x}:  else x := 3*x+1 : lst:=lst union {x}: end if; end do;lst2:=L intersect lst:n2:=nops(lst2 ): printf(`%d, `,n2): L:=L union lst:od:
  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; found = {}; Table[c = Collatz[n]; r = Intersection[c, found]; found = Union[found, c]; Length[r], {n, 100}] (* T. D. Noe, Feb 23 2013 *)

A222297 Irregular triangle of numbers first appearing in the Collatz (3x+1) iteration of n.

Original entry on oeis.org

1, 2, 3, 4, 5, 8, 10, 16, 6, 7, 11, 13, 17, 20, 22, 26, 34, 40, 52, 9, 14, 28, 12, 15, 23, 35, 46, 53, 70, 80, 106, 160, 18, 19, 29, 44, 58, 88, 21, 32, 64, 24, 25, 38, 76, 27, 31, 41, 47, 61, 62, 71, 82, 91, 92, 94, 103, 107, 121, 122, 124, 137, 142, 155, 161
Offset: 1

Views

Author

T. D. Noe, Feb 23 2013

Keywords

Comments

Sequence A222118 gives the number of terms in each row.

Examples

			The irregular table begins
{1},
{2},
{3, 4, 5, 8, 10, 16},
{},
{},
{6},
{7, 11, 13, 17, 20, 22, 26, 34, 40, 52},
{},
{9, 14, 28},
{},
{},
{12},
{},
{},
{15, 23, 35, 46, 53, 70, 80, 106, 160}
		

Crossrefs

Cf. A222118.

Programs

  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; found = {}; t = Table[c = Collatz[n]; r = Complement[c, found]; found = Union[found, c]; r, {n, 27}]; Flatten[t]

A213672 Final term in Collatz trajectory of n that did not appear in previous trajectories.

Original entry on oeis.org

1, 2, 4, 0, 0, 6, 20, 0, 14, 0, 0, 12, 0, 0, 80, 0, 0, 18, 44, 0, 32, 0, 0, 24, 38, 0, 92, 0, 0, 30, 0, 0, 50, 0, 0, 36, 56, 0, 152, 0, 0, 42, 74, 0, 68, 0, 0, 48, 0, 0, 116, 0, 0, 54, 188, 0, 86, 0, 0, 60, 0, 0, 728, 0, 0, 66, 0, 0, 104, 0, 0, 72, 110, 0, 128, 0
Offset: 1

Views

Author

Jayanta Basu, Mar 03 2013

Keywords

Comments

This can be considered as the step down value, as beyond this point the trajectory of n reduces to a lower trajectory. When n is impure we define a(n)=0; see also A177729.

Examples

			a(7)=20 because after 20 trajectory of 7 becomes identical with trajectory of 3.
		

Crossrefs

Programs

  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; prev = {}; Table[c = Collatz[n]; If[Complement[c, prev] == {}, 0, i = 1; While[MemberQ[prev, c[[-i]]], i++]; prev = Union[prev, c]; c[[-i]]], {n, 100}] (* T. D. Noe, Mar 03 2013 *)
Showing 1-5 of 5 results.