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.

Previous Showing 81-90 of 121 results. Next

A308149 Positive integers with Collatz trajectories that do not include the number 5.

Original entry on oeis.org

1, 2, 4, 8, 16, 21, 32, 42, 64, 75, 84, 85, 113, 128, 150, 151, 168, 170, 201, 226, 227, 256, 267, 300, 301, 302, 336, 340, 341, 401, 402, 403, 423, 452, 453, 454, 475, 512, 534, 535, 537, 600, 602, 604, 605, 633, 635, 672, 680, 682, 713, 715, 802, 803, 804, 805, 806, 846, 847, 891, 904, 906, 908, 909, 950, 951, 953, 955
Offset: 1

Views

Author

Nathan Bumber, May 14 2019

Keywords

Comments

A consequence of the Collatz conjecture is that, after a(5), this would be equivalent to the list of positive integers with Collatz trajectories that include the number 32.

Examples

			21 is a term because its Collatz trajectory, given in A033481, does not include 5.
		

Crossrefs

A000079 is a subsequence.

Programs

  • Mathematica
    collatzTrajectory[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; Select[Range[1000], Not[MemberQ[collatzTrajectory[#], 5]] &] (* Alonso del Arte, May 25 2019 *)

A329263 Irregular triangle read by rows in which row n is the result of iterating the operation f(n) = n/8 if n == 0 (mod 8), otherwise f(n) = 8*(floor(n/8) + n + 1), terminating at the first occurrence of 1.

Original entry on oeis.org

1, 2, 24, 3, 32, 4, 40, 5, 48, 6, 56, 7, 64, 8, 1, 3, 32, 4, 40, 5, 48, 6, 56, 7, 64, 8, 1, 4, 40, 5, 48, 6, 56, 7, 64, 8, 1, 5, 48, 6, 56, 7, 64, 8, 1, 6, 56, 7, 64, 8, 1, 7, 64, 8, 1, 8, 1, 9, 88, 11, 104, 13, 120, 15, 136, 17, 160, 20, 184, 23, 208
Offset: 1

Views

Author

Davis Smith, Nov 09 2019

Keywords

Comments

The operation f(n) can be generalized to C(n,m) = n/m if n == 0 (mod m), m*(floor(n/m) + n + 1) otherwise. The operation for the 3x+1 (Collatz) problem is equivalent to C(n,2) and f(n) = C(n,8).
Conjecture: For any initial value of n >= 1 there is a number k such that f^{k}(n) = 1; in other words, every row of the triangle is finite.

Examples

			The irregular array a(n,k) starts:
n\k   0   1   2   3   4    5   6    7   8    9  10  11  12  13 ...
1:    1
2:    2  24   3  32   4   40   5   48   6   56   7  64   8   1
3:    3  32   4  40   5   48   6   56   7   64   8   1
4:    4  40   5  48   6   56   7   64   8    1
5:    5  48   6  56   7   64   8    1
6:    6  56   7  64   8    1
7:    7  64   8   1
8:    8   1
9:    9  88  11 104  13  120  15  136  17  160  20 184  23 208 ...
10:  10  96  12 112  14  128  16    2  24    3  32   4  40   5 ...
a(9,100) = 1 and a(10,20) = 1.
		

Crossrefs

Cf. A070165.

Programs

  • PARI
    collatz8(n)=N=[n];while(n>1,N=concat(N,n=if(n%8,8*(floor(n/8)+n+1),n/8)));N

Formula

a(n,0) = n, a(n,k + 1) = a(n,k)/8 if a(n,k) == 0 (mod 8), 8*(floor(a(n,k)/8) + a(n,k) + 1) otherwise, for n >= 1.

A330073 Irregular triangle read as rows in which row n is the result of iterating the operation f(n) = n/5 if n == 0 (mod 5), otherwise f(n) = 5*(floor(n/5) + n + 1), terminating at the first occurrence of 1.

Original entry on oeis.org

1, 2, 15, 3, 20, 4, 25, 5, 1, 3, 20, 4, 25, 5, 1, 4, 25, 5, 1, 5, 1, 6, 40, 8, 50, 10, 2, 15, 3, 20, 4, 25, 5, 1, 7, 45, 9, 55, 11, 70, 14, 85, 17, 105, 21, 130, 26, 160, 32, 195, 39, 235, 47, 285, 57, 345, 69, 415, 83, 500, 100, 20, 4, 25, 5, 1, 8, 50
Offset: 1

Views

Author

Davis Smith, Nov 30 2019

Keywords

Comments

f(n) is the operation C(n,m) = n/m if n == 0 (mod m), m*(floor(n/m) + n + 1) otherwise where m = 5. C(n,2) is the operation in the Collatz problem (A070165) and C(n,8) is the operation in A329263.
Conjecture: For any initial value n >= 1, there is a number k such that f^{k}(n) = 1, where f^{0}(n) = n and f^{k}(n) = f(f^{k - 1}(n)).
For any number n, if n is a power of 5 multiplied by 1, 2, 3, or 4, then there is a number k such that f^{k}(n) = 1. If n is congruent to 10, 15, 20, or 25 (mod 30) and there is a k such that f^{k}(n) = 1, then f^{k + 1}(floor(n/6)) = 1.

Examples

			The irregular array T(n,k) starts:
n\k   0   1   2   3   4   5   6   7   8   9   10   11   12   13 ...
1:    1
2:    2  15   3  20   4  25   5   1
3:    3  20   4  25   5   1
4:    4  25   5   1
5:    5   1
6:    6  40   8  50  10   2  15   3  20   4   25    5    1
7:    7  45   9  55  11  70  14  85  17 105   21  130   26  160 ...
8:    8  50  10   2  15   3  20   4  25   5    1
9:    9  55  11  70  14  85  17 105  21 130   26  160   32  195 ...
10:  10   2  15   3  20   4  25   5   1
T(7,31) = 1 and T(9,29) = 1.
		

Crossrefs

Programs

  • Mathematica
    Array[NestWhileList[If[Mod[#, 5] == 0, #/5, 5 (Floor[#/5] + # + 1)] &, #, # > 1 &] &, 8] // Flatten (* Michael De Vlieger, Dec 01 2019 *)
  • PARI
    row(n)=my(N=[n],m=5);while(n>1,N=concat(N,n=if(n%m,m*(n+floor(n/m)+1),n/m)));N

Formula

T(n,0) = n, T(n,k + 1) = T(n,k)/5 if T(n,k) == 0 (mod 5), 5*(T(n,k) + floor(T(n,k)/5) + 1) otherwise, for n >= 1.

A333861 The sum of the Hamming weights of the elements of the Collatz orbit of n.

Original entry on oeis.org

1, 2, 11, 3, 7, 13, 35, 4, 43, 9, 29, 15, 16, 38, 43, 5, 24, 45, 49, 11, 10, 32, 35, 17, 58, 19, 527, 41, 42, 47, 507, 6, 66, 26, 28, 47, 50, 52, 100, 13, 520, 13, 73, 35, 34, 39, 497, 19, 59, 61, 66, 22, 21, 531, 537, 44, 85, 46, 91, 51, 52, 512, 523, 7, 67
Offset: 1

Views

Author

Markus Sigg, Apr 08 2020

Keywords

Examples

			The Collatz orbit of 3 is 3,10,5,16,8,4,2,1. The Hamming weights are 2,2,2,1,1,1,1,1. The sum is a(3) = 11.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Total[DigitCount[#, 2, 1] & /@ NestWhileList[If[OddQ[#], 3*# + 1, #/2] &, n, # > 1 &]]; Array[a, 65] (* Amiram Eldar, Jul 29 2023 *)
  • PARI
    a(n) = my(c = hammingweight(n)); while(n>1, n = if(n%2 == 0, n/2, 3*n+1); c += hammingweight(n)); c;

Formula

a(n) = Sum_{k=1..A008908(n)} A000120(A070165(n,k)). - Alois P. Heinz, Apr 10 2020
a(n) = a(A006370(n)) + A000120(n), with a(1) = 1. - Alan Michael Gómez Calderón, Jul 15 2025

A347669 Indices of first occurrences of n in A347409.

Original entry on oeis.org

1, 2, 4, 8, 3, 15, 21, 128, 75, 512, 151, 2048, 1365, 8192, 5461, 7407, 14563, 131072, 87381, 524288, 184111, 2097152, 932067, 6213783, 5592405, 33554432, 13256071, 134217728, 26512143, 530242875, 357913941, 1899273247, 1431655765, 8589934592, 3817748707, 34359738368
Offset: 0

Views

Author

Paolo Xausa, Sep 10 2021

Keywords

Examples

			a(5) = 15 because 5 occurs for the first time at position 15 in A347409.
		

Crossrefs

Programs

  • Mathematica
    A347409[n_]:=A347409[n]=(c=n;sm=0;While[c>1,If[OddQ[c],c=3c+1,If[(s=IntegerExponent[c,2])>sm,sm=s];c/=2^s]];sm)
    nterms=20;Table[i=0;While[A347409[++i]!=n];i,{n,0,nterms-1}]
  • PARI
    f(n) = {my(nb=0); while (n != 1, if (n % 2, n=3*n+1, my(x = valuation(n, 2)); n /= 2^x; nb = max(nb, x)); ); nb; } \\ A347409
    a(n) = my(k=1); while (f(k) != n, k++); k; \\ Michel Marcus, Sep 10 2021

Extensions

a(21)-a(22) from Michel Marcus, Sep 10 2021
a(23)-a(28) from Alois P. Heinz, Sep 11 2021
a(29)-a(34) from Michael S. Branicky, Sep 28 2021
a(35) from Chai Wah Wu, Oct 02 2021

A348006 Largest increment in the trajectory from n to 1 in the Collatz map (or 3x+1 problem), or -1 if no such trajectory exists.

Original entry on oeis.org

0, 0, 11, 0, 11, 11, 35, 0, 35, 11, 35, 11, 27, 35, 107, 0, 35, 35, 59, 11, 43, 35, 107, 11, 59, 27, 6155, 35, 59, 107, 6155, 0, 67, 35, 107, 35, 75, 59, 203, 11, 6155, 43, 131, 35, 91, 107, 6155, 11, 99, 59, 155, 27, 107, 6155, 6155, 35, 131, 59, 203, 107
Offset: 1

Views

Author

Paolo Xausa, Oct 02 2021

Keywords

Comments

The largest increment occurs when the trajectory reaches its largest value via a 3x+1 step.
All nonzero terms are odd, since they are of the form 2k+1, for some k >= 5.

Examples

			a(3) = 11 because the trajectory starting at 3 is 3 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1, and the largest increment (from 5 to 16) is 11.
a(4) = 0 because there are only halving steps in the Collatz trajectory starting at 4.
		

Crossrefs

Programs

  • Mathematica
    nterms=100;Table[c=n;mr=0;While[c>1,If[OddQ[c],mr=Max[mr,2c+1];c=3c+1,c/=2^IntegerExponent[c,2]]];mr,{n,nterms}]
  • PARI
    a(n)=n>>=valuation(n,2); my(r); while(n>1, my(t=2*n+1); n+=t; n>>=valuation(n,2); if(t>r, r=t)); r \\ Charles R Greathouse IV, Oct 25 2022
  • Python
    def A348006(n):
        c, mr = n, 0
        while c > 1:
            if c % 2:
                mr = max(mr, 2*c+1)
                c = 3*c+1
            else:
                c //= 2
        return mr
    print([A348006(n) for n in range(1, 100)])
    

Formula

If n = 2^k (for k >= 0), a(n) = 0; otherwise a(n) = 2*A087232(n)+1 = (2*A025586(n)+1)/3 = A025586(n)-A087232(n).

A348007 Starting value of the longest run of halving steps in the trajectory from n to 1 in the Collatz map (or 3x+1 problem), or -1 if no such trajectory exists.

Original entry on oeis.org

2, 16, 4, 16, 16, 16, 8, 16, 16, 16, 16, 16, 16, 160, 16, 16, 16, 16, 16, 64, 16, 160, 16, 16, 16, 160, 16, 16, 160, 160, 32, 16, 16, 160, 16, 112, 16, 304, 16, 160, 64, 112, 16, 16, 160, 160, 48, 112, 16, 16, 16, 160, 160, 160, 16, 112, 16, 304, 160, 160, 160
Offset: 2

Views

Author

Paolo Xausa, Sep 24 2021

Keywords

Comments

In case of ties (two or more longest runs of same length), the highest starting value is picked. The first n for which the longest run of halving steps occurs at two different subtrajectories is 37, where the Collatz map contains the 4-step subtrajectories 112 -> 56 -> 28 -> 14 > 7 and 16 -> 8 -> 4 -> 2 -> 1. a(37) is therefore 112 (highest starting value).
If the Collatz conjecture (i.e., all trajectories reach 1) is true then, except for n = 2, 4 and 8, a(n) mod 16 = 0, since all trajectories contain (at least) 4 consecutive halvings.

Examples

			a(2) = 2 because the Collatz trajectory from 2 to 1 is simply 2 -> 1 (one halving step, starting at 2).
a(3) = 16 because the trajectory from 3 to 1 is 3 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1. Here, the longest halving run is the 4-step subtrajectory 16 -> 8 -> 4 -> 2 -> 1, which starts at 16.
a(15) = 160 because the longest halving run in the trajectory from 15 to 1 (the 5-step subtrajectory 160 -> 80 -> 40 -> 20 -> 10 -> 5) starts at 160.
		

Crossrefs

Programs

  • Mathematica
    nterms=100;Table[c=n;cm=sm=0;While[c>1,If[OddQ[c],c=3c+1,s=IntegerExponent[c,2];If[s>sm,sm=s;cm=c,If[s==sm,cm=Max[cm,c]]];c/=2^s]];cm,{n,2,nterms+1}]
  • PARI
    A348007(n) = { my(m2v=valuation(n,2), mx=n, t); while(n>1, if((t=valuation(n,2))>m2v, m2v=t; mx=n, if(t==m2v && n>mx, mx=n)); if(!(n%2),n/=2,n+=(n+n+1))); (mx); }; \\ Antti Karttunen, Oct 13 2021

Formula

a(2^k) = 2^k, for integers k >= 1.
a(n) mod 2^A347409(n) = 0.

A187763 Number of common terms in consecutive Collatz trajectories.

Original entry on oeis.org

1, 2, 3, 3, 6, 7, 4, 4, 7, 7, 7, 7, 10, 9, 5, 5, 13, 16, 8, 5, 5, 9, 7, 7, 11, 9, 9, 16, 9, 17, 5, 5, 14, 9, 9, 19, 16, 22, 9, 9, 5, 5, 16, 14, 9, 17, 7, 7, 16, 20, 12, 9, 12, 106, 9, 20, 16, 20, 9, 17, 20, 95, 5, 5, 16, 23, 14, 12, 9, 15, 9, 9, 9, 5, 5, 20
Offset: 1

Views

Author

Reinhard Zumkeller, Jan 04 2013

Keywords

Comments

Size of intersection of row n and row n+1 in A070165.

Examples

			.                                | Rows in A070165 (trajectories)
a(1) = #{1} = 1;                 | 1
a(2) = #{2,1} = 2;               | 2,1
a(3) = #{4,2,1} = 3;             | 3,10,5,16,8,4,2,1
a(4) = #{4,2,1} = 3;             | 4,2,1
a(5) = #{5,16,8,4,2,1} = 6;      | 5,16,8,4,2,1
a(6) = #{10,5,16,8,4,2,1} = 7;   | 6,3,10,5,16,8,4,2,1
a(7) = #{8,4,2,1} = 4;           | 7,22,11,34,17,52,26,13,40,20,10,5,..
a(8) = #{8,4,2,1} = 4;           | 8,4,2,1
a(9) = #{10,5,16,8,4,2,1} = 7;   | 9,28,14,7,22,11,34,17,52,26,13,40,..
a(10) = #{10,5,16,8,4,2,1} = 7;  | 10,5,16,8,4,2,1
a(11) = #{10,5,16,8,4,2,1} = 7;  | 11,34,17,52,26,13,40,20,10,5,16,8,4,..
a(12) = #{10,5,16,8,4,2,1} = 7.  | 12,6,3,10,5,16,8,4,2,1
.                                | 13,40,20,10,5,16,8,4,2,1 .
		

Programs

  • Haskell
    import Data.List (intersect)
    a187763 n = a187763_list !! (n-1)
    a187763_list = map length $
                   zipWith intersect a070165_tabf $ tail a070165_tabf
  • Mathematica
    coll[n_]:=NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&]; Table[Length[Intersection[coll[n],coll[n+1]]],{n,76}] (* Jayanta Basu, May 28 2013 *)

A213330 Minimum deviation from n in Collatz trajectory of n.

Original entry on oeis.org

0, 1, 1, 2, 1, 1, 1, 4, 1, 2, 1, 2, 3, 1, 1, 8, 1, 1, 1, 4, 5, 2, 3, 8, 1, 6, 4, 2, 3, 5, 4, 16, 1, 6, 5, 2, 3, 2, 1, 20, 1, 10, 3, 4, 5, 6, 1, 24, 3, 2, 1, 12, 13, 1, 2, 4, 1, 6, 1, 7, 8, 1, 2, 32, 9, 8, 9, 16, 17, 10, 1, 20, 2, 18, 10, 12, 11, 2, 3, 40, 1, 2
Offset: 1

Views

Author

Jayanta Basu, Mar 03 2013

Keywords

Comments

Assuming Collatz trajectory ends with 1 and also a(1)=0.

Examples

			a(4)=2 because the number closest to 4 in Collatz trajectory of 4 is 2.
		

Crossrefs

Cf. A070165, A355239 (indices of 1's).

Programs

  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; Join[{0}, Table[Min[Rest[Abs[Collatz[n] - n]]], {n, 2, 100}]]

A213538 Maximum deviation from n in Collatz trajectory of n.

Original entry on oeis.org

0, 1, 13, 3, 11, 10, 45, 7, 43, 9, 41, 11, 27, 38, 145, 15, 35, 34, 69, 19, 43, 30, 137, 23, 63, 25, 9205, 27, 59, 130, 9201, 31, 67, 33, 125, 35, 75, 50, 265, 39, 9191, 41, 153, 43, 91, 114, 9185, 47, 99, 49, 181, 51, 107, 9178, 9177, 55, 139, 57, 245, 100, 123
Offset: 1

Views

Author

Jayanta Basu, Mar 03 2013

Keywords

Comments

Assuming Collatz trajectory ends with 1 and also a(1)=0.

Examples

			a(3)=13 because the number furthest to 3 in Collatz trajectory of 3 is 16.
		

Crossrefs

Cf. A070165.

Programs

  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; Join[{0}, Table[Max[Rest[Abs[Collatz[n] - n]]], {n, 2, 100}]] (* T. D. Noe, Mar 04 2013 *)
Previous Showing 81-90 of 121 results. Next