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

A220263 Lengths of Collatz trajectories starting with terms of A177729.

Original entry on oeis.org

1, 2, 8, 9, 17, 20, 10, 18, 21, 21, 8, 11, 24, 112, 19, 27, 22, 22, 35, 9, 30, 17, 12, 25, 113, 113, 33, 20, 108, 28, 15, 23, 116, 15, 36, 36, 23, 10, 31, 18, 18, 13, 119, 26, 26, 39, 114, 114, 70, 34, 34, 21, 21, 47, 109, 47, 122, 29, 29, 42, 16, 16, 24
Offset: 1

Views

Author

Reinhard Zumkeller, Jan 03 2013

Keywords

Comments

Row lengths in A192719.

Crossrefs

Cf. A006577.

Programs

  • Haskell
    a220263 = length . a192719_row
  • Mathematica
    coll[n_]:=NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&]; t={1}; Do[If[FreeQ[Union@@Table[coll[i],{i,n-1}],n],AppendTo[t,Length[coll[n]]]],{n,2,144}]; t (* Jayanta Basu, May 29 2013 *)

A061641 Pure numbers in the Collatz (3x+1) iteration. Also called pure hailstone numbers.

Original entry on oeis.org

0, 1, 3, 6, 7, 9, 12, 15, 18, 19, 21, 24, 25, 27, 30, 33, 36, 37, 39, 42, 43, 45, 48, 51, 54, 55, 57, 60, 63, 66, 69, 72, 73, 75, 78, 79, 81, 84, 87, 90, 93, 96, 97, 99, 102, 105, 108, 109, 111, 114, 115, 117, 120, 123, 126, 127, 129, 132, 133, 135, 138, 141, 144, 145
Offset: 1

Views

Author

Frederick Magata (frederick.magata(AT)uni-muenster.de), Jun 14 2001

Keywords

Comments

Let {f(k,N), k=0,1,2,...} denote the (3x+1)-sequence with starting value N; a(n) denotes the smallest positive integer which is not contained in the union of f(k,0),...,f(k,a(n-1)).
In other words, a(n) is the starting value of the next '3x+1'-sequences in the sense that a(n) is not a value in any sequence f(k,N) with N < a(n).
f(0,N)=N, f(k+1,N)=f(k,N)/2 if f(k,N) is even and f(k+1,N)=3*f(k,N)+1 if f(k,N) is odd.
For all n, a(n) mod 6 is 0, 1 or 3. I conjecture that a(n)/n -> C=constant for n->oo, where C=2.311...
The Collatz conjecture says that for all positive n, there exists k such that C_k(n) = 1. Shaw states [p. 195] that "A positive integer n is pure if its entire tree of preimages under the Collatz function C are greater than or equal to it; otherwise n is impure. Equivalently, a positive integer n is impure if there exists rGary W. Adamson, Jan 28 2007
Pure numbers remaining after deleting the impure numbers in the hailstone (Collatz) problem; where the operation C(n) = {3n+1, n odd; n/2, n even}. Add the 0 mod 3 terms in order, among the terms of A127633, since all 0 mod 3 numbers are pure. - Gary W. Adamson, Jan 28 2007
After computing all a(n) < 10^9, the ratio a(n)/n appears to be converging to 2.31303... Hence it appears that the numbers in this sequence have a density of about 1/3 (due to all multiples of 3) + 99/1000. - T. D. Noe, Oct 12 2007
A016945 is a subsequence. - Reinhard Zumkeller, Apr 17 2008

Examples

			Consider n=3: C(n), C_2(n), C_3(n), ...; the iterates are 10, 5, 16, 8, 4, 2, 1, 4, 2, 1; where 4, 5, 8, 10 and 16 have appeared in the orbit of 3 and are thus impure.
a(1)=1 since Im(f(k,0))={0} for all k and so 1 is not a value of f(k,0). a(2)=3 since Im(f(k,0)) union Im(f(k,1))={0,1,2,4} and 3 is the smallest positive integer not contained in this set.
		

Crossrefs

Cf. A070165 (Collatz trajectories), A127633, A336938, A336938. See A177729 for a variant.

Programs

  • Mathematica
    DoCollatz[n_] := Module[{m = n}, While[m > nn || ! reached[[m]], If[m <= nn, reached[[m]] = True]; If[EvenQ[m], m = m/2, m = 3 m + 1]]]; nn = 200; reached = Table[False, {nn}]; t = {0, 1}; While[DoCollatz[t[[-1]]]; pos = Position[reached, False, 1, 1]; pos != {}, AppendTo[t, pos[[1, 1]]]]; t (* T. D. Noe, Jan 22 2013 *)
  • PARI
    firstMiss(A) = { my(i); if(#A == 0 || A[1] > 0, return(0)); for(i = 1, A[#A] + 1, if(!setsearch(A,i), return(i))); };
    iter(A) = { my(a = firstMiss(A)); while(!setsearch(A,a), A = setunion(A, Set([a])); a = if(a % 2, 3*a+1, a/2)); A; };
    makeVec(m) = { my(v = [], A = Set([]), i); for(i = 1, m, v = concat(v, firstMiss(A)); if (i < m, A = iter(A))); v; };
    makeVec(64) \\ Markus Sigg, Aug 08 2020

Extensions

Edited by T. D. Noe and N. J. A. Sloane, Oct 16 2007

A192719 Chain of Collatz sequences.

Original entry on oeis.org

1, 2, 1, 3, 10, 5, 16, 8, 4, 2, 1, 6, 3, 10, 5, 16, 8, 4, 2, 1, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, 9, 28, 14, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, 12, 6, 3, 10, 5, 16, 8, 4, 2, 1
Offset: 1

Views

Author

Robert C. Lyons, Dec 31 2012

Keywords

Comments

The sequence is a chain of Collatz sequences. The first Collatz sequence in the chain is (1). Each of the subsequent Collatz sequences in the chain starts with the minimum positive integer that does not appear in the previous Collatz sequences. If the Collatz conjecture is true, then each Collatz sequence in the chain will end with 1, and the chain will include an infinite number of distinct Collatz sequences. If the Collatz conjecture is false, then the chain will end with the first Collatz sequence that does not converge to 1.
T(n,1) = A177729(n). - Reinhard Zumkeller, Jan 03 2013

Examples

			The first Collatz sequence in the chain is (1). The second Collatz sequence in the chain is (2, 1), which starts with 2, since 2 is the smallest positive integer that doesn't appear the first Collatz sequence. The third Collatz sequence in the chain is (3, 10, 5, 16, 8, 4, 2, 1), which starts with 3, since 3 is the smallest positive integer that doesn't appear the previous Collatz sequences.
Thus this irregular array starts:
1;
2,  1;
3, 10,  5, 16,  8,  4,  2,  1;
6,  3, 10,  5, 16,  8,  4,  2,  1;
7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10,  5, 16,  8, 4,  2, 1;
9, 28, 14,  7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1;
...
		

Crossrefs

Programs

  • Haskell
    a192719 n k = a192719_tabf !! (n-1) !! (k-1)
    a192719_row n = a192719_tabf !! (n-1)
    a192719_tabf = f [1..] where
       f (x:xs) = (a070165_row x) : f (del xs $ a220237_row x)
       del us [] = us
       del us'@(u:us) vs'@(v:vs) | u > v     = del us' vs
                                 | u < v     = u : del us vs'
                                 | otherwise = del us vs
    -- Reinhard Zumkeller, Jan 03 2013
  • Java
    See Lyons link.
    

A222118 Number of terms in Collatz (3x+1) trajectory of n that did not appear in previous trajectories.

Original entry on oeis.org

1, 1, 6, 0, 0, 1, 10, 0, 3, 0, 0, 1, 0, 0, 9, 0, 0, 1, 5, 0, 3, 0, 0, 1, 3, 0, 95, 0, 0, 1, 0, 0, 3, 0, 0, 1, 3, 0, 12, 0, 0, 1, 8, 0, 3, 0, 0, 1, 0, 0, 5, 0, 0, 1, 7, 0, 3, 0, 0, 1, 0, 0, 13, 0, 0, 1, 0, 0, 3, 0, 0, 1, 3, 0, 8, 0, 0, 1, 9, 0, 1, 0, 0, 1, 0, 0, 7
Offset: 1

Views

Author

Jayanta Basu, Feb 23 2013

Keywords

Comments

For n > 2, n such that a(n) = 0 are termed impure (A134191), while n such that a(n) > 0 are termed pure (A061641). - T. D. Noe, Feb 23 2013
From Robert G. Wilson v, Feb 25 2017: (Start)
For a(n) to be equal to 0, n != 0 (mod 3),
For a(n) to be an even positive number, n = {3, 7} (mod 12),
For a(n) to be equal to 1, n = {0, 1, 2, 3, 6, 7, 9} (mod 12),
For a(n) to be equal to 3, n = {1, 3, 9} (mod 12),
For a(n) to be an odd number > 3, n = {3, 7} (mod 12).
[Note that the above conditions are necessary but not sufficient. - Editors, Dec 15 2017]
(End)
a(n) gives the number of new terms in the n-th row of A070165 (see A263716). - Andrey Zabolotskiy, Feb 27 2017

Examples

			a(7) = 10, since trajectory of 7 includes 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, which did not appear in earlier trajectories.
		

Crossrefs

Programs

  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; found = {}; Table[c = Collatz[n]; r = Complement[c, found]; found = Union[found, c]; Length[r], {n, 100}] (* T. D. Noe, Feb 23 2013 *)
  • Python
    s = set([1])
    print(1)
    for n in range(2, 100):
        m, r = n, 0
        while m not in s:
            s.add(m)
            m = (m//2 if m%2==0 else 3*m+1)
            r += 1
        print(r)
    # Andrey Zabolotskiy, Feb 21 2017

Formula

a(n) = A006577(n) - A221956(n) + 1. - Michel Lagneau, Feb 23 2013

A187831 Smallest number m > n such that n occurs in Collatz trajectory starting with m; a(0) = 1 by convention.

Original entry on oeis.org

1, 2, 3, 6, 5, 6, 12, 9, 9, 18, 11, 14, 24, 14, 18, 30, 17, 18, 36, 25, 22, 42, 25, 27, 48, 33, 28, 54, 36, 33, 60, 41, 42, 66, 36, 41, 72, 43, 39, 78, 41, 54, 84, 57, 50, 90, 47, 54, 96, 57, 66, 102, 56, 54, 108, 73, 57, 114, 59, 78, 120, 62, 82, 126, 75
Offset: 0

Views

Author

Reinhard Zumkeller, Jan 04 2013

Keywords

Comments

A070165(a(n),k) = n for some k with 1 <= k <= A006577(a(n)).

Examples

			n = 10: row 11 of A070165 = [11,34,17,52,26,13,40,20,10,5,16,8,4,2,1],
therefore A070165(11,9) = 10 and a(10) = 11;
n = 11: rows 12 and 13 of A070165 don't contain 11, but 14 does:
row 12: [12,6,3,10,5,16,8,4,2,1],
row 13: [13,40,20,10,5,16,8,4,2,1],
row 14: [14,7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1],
therefore A070165(14,4) = 11: a(11) = 14.
		

Crossrefs

Programs

  • Haskell
    import Data.List (find)
    import Data.Maybe (fromJust)
    a187831 0 = 1
    a187831 n = head $ fromJust $
            find (n `elem`) $ drop (fromIntegral n) a070165_tabf
  • Mathematica
    mcollQ[n_,k_]:=MemberQ[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&],k]==True; Prepend[Table[i=n+1; While[!mcollQ[i,n],i++]; i,{n,64}],1] (* Jayanta Basu, May 27 2013 *)
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; Join[{1}, Table[k = n + 1; While[! MemberQ[Collatz[k], n], k++]; k, {n, 100}]] (* T. D. Noe, May 28 2013 *)

A359226 a(n) is the least k >= 0 such that A006370^k(A070167(n)) = n (where A006370^k denotes the k-th iterate of A006370).

Original entry on oeis.org

0, 0, 0, 5, 2, 0, 0, 4, 0, 1, 2, 0, 7, 2, 0, 3, 4, 0, 0, 9, 0, 1, 2, 0, 0, 6, 0, 1, 2, 0, 5, 2, 0, 3, 4, 0, 0, 2, 0, 8, 2, 0, 0, 4, 0, 1, 7, 0, 5, 2, 0, 5, 6, 0, 0, 2, 0, 1, 2, 0, 92, 4, 0, 1, 2, 0, 7, 2, 0, 3, 9, 0, 0, 7, 0, 1, 2, 0, 0, 8, 0, 1, 2, 0, 5, 2, 0
Offset: 1

Views

Author

Rémy Sigrist, Dec 22 2022

Keywords

Comments

If we travel the Collatz tree backwards, we will observe no further branching, whenever we have reached a number divisible by three. This is the reason why a(n) will be zero in all cases where n is divisible by three, because in this case no smaller number can exist further upward in the Collatz tree, as the actual branch will progress in numbers of the form 3*m*2^k. - Thomas Scheuerle, Dec 22 2022

Examples

			The Collatz sequence starting from 1 is: 1.
So a(1) = 0.
The Collatz sequence starting from 2 is: 2, 1.
So a(2) = 0.
The Collatz sequence starting from 3 is: 3, 10, 5, 16, 8, 4, 2, 1.
So a(3) = 0, a(10) = 1, a(5) = 2, a(16) = 3, a(8) = 4, a(4) = 5.
		

Crossrefs

Programs

Formula

a(n) = 0 iff n belongs to A177729.
If a(n) > 0 and n is odd, then a(n*3+1) - a(n) = 1. If a(n) > 0 and n is even, then a(n*3+1) - a(n*6+2) = 1. - Thomas Scheuerle, Dec 22 2022

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 *)

A235452 Take the union of all the sequences Collatz(i) for i <= n. The number a(n) is the largest of consecutive numbers beginning with 1.

Original entry on oeis.org

1, 2, 5, 5, 5, 6, 8, 8, 11, 11, 11, 14, 14, 14, 17, 17, 17, 18, 20, 20, 23, 23, 23, 24, 26, 26, 29, 29, 29, 32, 32, 32, 35, 35, 35, 36, 38, 38, 41, 41, 41, 42, 44, 44, 47, 47, 47, 50, 50, 50, 53, 53, 53, 54, 56, 56, 59, 59, 59, 62, 62, 62, 65, 65, 65
Offset: 1

Views

Author

Martin Y. Champel, Jan 10 2014

Keywords

Comments

The Collatz sequence is also called the 3x+1 sequence.

Examples

			Let the C(n) function compute the Collatz sequence starting at n.
For n = 1, C(1) = {1} then term 1 is 1.
For n = 2, C(2) = {1,2} then term 2 is 2.
For n = 3, C(3) = {3,10,5,16,8,4,2,1} = {1,2,3,4,5,8,10,16} then it contains {1,2,3,4,5} but not {1,2,3,4,5,6} then term 3 is 5.
For n = 4, C(4) = C(3) then term 4 is 5.
For n = 5, C(5) = C(4) = C(3) then term 5 is 5.
For n = 6, C(6) = {1,2,3,4,5,6,8,10,16} then term 6 is 6.
		

Crossrefs

Programs

  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; countConsec[lst_] := Module[{cnt = 0, i = 1}, While[i <= Length[lst] && lst[[i]] == i, cnt++; i++]; cnt]; mx = 0; u = {}; Table[c = Collatz[n]; u = Union[u, c]; mx = Max[mx, countConsec[u]], {n, 65}] (* T. D. Noe, Feb 23 2014 *)
  • Python
    def A235452(n=100):
        a = set([])
        A235452 = {1: 1}
        for i in range(2, n):
            c = i
            a.add(c)
            while c != 1:
                if c % 2 == 1:
                    c = 3 * c + 1
                    a.add(c)
                c = c / 2
                a.add(c)
            k = 1
            while k in a:
                k += 1
            A235452[i] = k - 1
        return A235452
    seq_map = A235452()
    for n in range(1, len(seq_map) + 1):
        print(seq_map[n], end=", ")

A318613 Length of iterations of positive integers which do not appear in a Collatz sequence starting from a smaller positive integer.

Original entry on oeis.org

0, 1, 7, 8, 16, 19, 9, 17, 20, 20, 7, 10, 23, 111, 18, 26, 21, 21, 34, 8, 29, 16, 11, 24, 112, 112, 32, 19, 107, 27, 14, 22, 115, 14, 35, 35, 22, 9, 30, 17, 17, 12, 118, 25, 25, 38, 113, 113, 69, 33, 33, 20, 20, 46, 108, 46, 121, 28, 28, 41, 15, 15
Offset: 1

Views

Author

Peter Stikker, Aug 30 2018

Keywords

Comments

The sequence of the length of the iteration in the Collatz sequence is known as A006577, and the sequence of positive integers which do not appear in a Collatz sequence starting from a smaller positive integer is listed as A177729. This sequence is basically the combination of the two. Taking the sequence A177729 as input and then listing the length of the iteration for those (from A006577).

Crossrefs

Almost the same as A127933.
Showing 1-9 of 9 results.