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-10 of 22 results. Next

A347270 Square array T(n,k) in which row n lists the 3x+1 sequence starting at n, read by antidiagonals upwards, with n >= 1 and k >= 0.

Original entry on oeis.org

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

Views

Author

Omar E. Pol, Aug 25 2021

Keywords

Comments

This array gives all 3x+1 sequences.
The 3x+1 or Collatz problem is described in A006370.
Column k gives the image of n at the k-th step.
This infinite square array contains the irregular triangles A070165, A235795 and A347271.
For a piping diagram of the 3x+1 problem see A235800.

Examples

			The corner of the square array begins:
   1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, ...
   2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, ...
   3,10, 5,16, 8, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, ...
   4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, ...
   5,16, 8, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, ...
   6, 3,10, 5,16, 8, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, ...
   7,22,11,34,17,52,26,13,40,20,10, 5,16, 8, 4, 2, 1, 4, 2, 1, ...
   8, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, ...
   9,28,14, 7,22,11,34,17,52,26,13,40,20,10, 5,16, 8, 4, 2, 1, ...
  10, 5,16, 8, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, ...
  11,34,17,52,26,13,40,20,10, 5,16, 8, 4, 2, 1, 4, 2, 1, 4, 2, ...
  12, 6, 3,10, 5,16, 8, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, ...
  13,40,20,10, 5,16, 8, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, ...
  14, 7,22,11,34,17,52,26,13,40,20,10, 5,16, 8, 4, 2, 1, 4, 2, ...
...
		

Crossrefs

Main diagonal gives A347272.
Parity of this sequence is A347283.
Largest value in row n gives A056959.
Number of nonpowers of 2 in row n gives A208981.
Some rows n are: A153727 (n=1), A033478 (n=3), A033479 (n=9), A033480 (n=15), A033481 (n=21), A008884 (n=27), A008880 (n=33), A008878 (n=39), A008883 (n=51), A008877 (n=57), A008874 (n=63), A258056 (n=75), A258098 (n=79), A008876 (n=81), A008879 (n=87), A008875 (n=95), A008873 (n=97), A008882 (n=99), A245671 (n=1729).
First four columns k are: A000027 (k=0), A006370 (k=1), A075884 (k=2), A076536 (k=3).

Programs

  • Maple
    T:= proc(n, k) option remember; `if`(k=0, n, (j->
          `if`(j::even, j/2, 3*j+1))(T(n, k-1)))
        end:
    seq(seq(T(d-k, k), k=0..d-1), d=1..20);  # Alois P. Heinz, Aug 25 2021
  • Mathematica
    T[n_, k_] := T[n, k] = If[k == 0, n, Function[j,
         If[EvenQ[j], j/2, 3*j + 1]][T[n, k - 1]]];
    Table[Table[T[d - k, k], {k, 0, d - 1}], {d, 1, 20}] // Flatten (* Jean-François Alcover, Mar 02 2022, after Alois P. Heinz *)

A057688 Trajectory of 5 under the '5x+1' map.

Original entry on oeis.org

5, 26, 13, 66, 33, 11, 56, 28, 14, 7, 36, 18, 9, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6, 3, 1, 6
Offset: 0

Views

Author

N. J. A. Sloane, Oct 20 2000

Keywords

Comments

The 'Px + 1 map': if x is divisible by any prime less than P then divide out these primes one at a time starting with the smallest; otherwise multiply x by P and add 1. This is similar to A057684, but with P = 5 instead of P = 13. - Alonso del Arte, Jul 04 2015

Examples

			7 is odd and not divisible by 3, so it's followed by 5 * 7 + 1 = 36.
36 is even, so it's followed by 36/2 = 18.
18 is even, so it's followed by 18/2 = 9.
9 is odd and divisible by 3, so it's followed by 9/3 = 3.
		

Crossrefs

Programs

  • Mathematica
    NestList[If[EvenQ[#], #/2, If[Mod[#, 3] == 0, #/3, 5# + 1]] &, 5, 100] (* Alonso del Arte, Jul 04 2015 *)
  • PARI
    Vec((5 + 26*x + 13*x^2 + 61*x^3 + 7*x^4 - 2*x^5 - 10*x^6 - 5*x^7 + 3*x^8 - 49*x^9 + 8*x^10 + 4*x^11 + 2*x^12 - 33*x^13 - 17*x^14 - 3*x^15) / ((1 - x)*(1 + x + x^2)) + O(x^100)) \\ Colin Barker, Oct 10 2019

Formula

a(0) = 5, a(n) = a(n - 1)/2 if a(n - 1) is even, a(n) = a(n - 1)/3 if a(n - 1) is odd and divisible by 3, a(n) = 5a(n - 1) otherwise.
From Colin Barker, Oct 10 2019: (Start)
G.f.: (5 + 26*x + 13*x^2 + 61*x^3 + 7*x^4 - 2*x^5 - 10*x^6 - 5*x^7 + 3*x^8 - 49*x^9 + 8*x^10 + 4*x^11 + 2*x^12 - 33*x^13 - 17*x^14 - 3*x^15) / ((1 - x)*(1 + x + x^2)).
a(n) = a(n-3) for n>15.
(End)

A057689 Maximal term in trajectory of P under the 'Px+1' map, where P = n-th prime, or -1 if no such term exists.

Original entry on oeis.org

16, 66, 50, 672, 20372, 494, 36918, 1404, 12210, 4248, 5070, 1682, 1850, 2210, 35882, 102720, 94484303672, 30084, 178992, 5330, 246560, 6890, 294253314, 8416400, 515202, 134004, 2810784, 2810883506682183650, 377198408, 320168
Offset: 2

Views

Author

N. J. A. Sloane, Oct 20 2000

Keywords

Comments

See A057684 for definition.

Examples

			For n=3, P=7: trajectory of 7 is 7, 50, 25, 5, 1, 8, 4, 2, 1, 8, 4, 2, 1, 8, 4, 2, 1, ..., which has maximal term 50, cycle length 4 and there are 4 terms before it enters the cycle.
		

Crossrefs

Programs

  • Mathematica
    Px1[p_,n_]:=Catch[For[i=1,iPaolo Xausa, Dec 11 2023 *)
  • Python
    from sympy import prime, primerange
    def a(n):
        P = prime(n)
        x, plst, seen = P, list(primerange(2, P)), set()
        while x > 1 and x not in seen:
            seen.add(x)
            x = next((x//p for p in plst if x%p == 0), P*x+1)
        return max(seen)
    print([a(n) for n in range(2, 32)]) # Michael S. Branicky, Dec 11 2023

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Nov 08 2000

A057690 Length of cycle in trajectory of P under the 'Px+1' map, where P = n-th prime, or -1 if trajectory does not cycle.

Original entry on oeis.org

3, 3, 4, 4, 3, 4, 4, 5, 4, 6, 3, 4, 4, 6, 5, 5, 3, 4, 6, 3, 6, 5, 5, 4, 4, 5, 6, 4, 4, 8, 5, 4, 5, 5, 5, 3, 4, 6, 4, 6, 4, 8, 3, 5, 6, 4, 7, 5, 4, 5, 7, 4, 6, 4, 6, 6, 6, 3, 12, 4, 5, 5, 6, 3, 4, 4, 4, 5, 5, 4, 7, 6, 4, 5, 9, 5, 3, 4, 4, 6, 3, 8, 4, 6, 5, 6, 3, 5, 6, 6, 8, 5, 5, 6, 7, 5, 5, 4, 3, 4, 5, 5, 5, 5, 4
Offset: 2

Views

Author

N. J. A. Sloane, Oct 20 2000

Keywords

Comments

See A057684 for definition.
Note that not all cycles for the iteration starting with p contain the number 1; a(60), for the prime 281, is the first example of this. Its iterates are: 281, 78962, 39481, 3037, 853398, 426699, 142233, 47411, 6773, 521, 146402, 73201, 1031, 289712, 144856, 72428, 36214, 18107, 953, 267794, 133897, with the last 12 terms cycling. Another example is provided by 2543, the 372nd prime. - T. D. Noe, Apr 02 2008

Examples

			For n=4, P=7: trajectory of 7 is 7, 50, 25, 5, 1, 8, 4, 2, 1, 8, 4, 2, 1, 8, 4, 2, 1, ..., which has maximal term 50, cycle length 4 and there are 4 terms before it enters the cycle.
		

Crossrefs

Programs

  • Mathematica
    Px1[p_,n_]:=Catch[For[i=1,iPaolo Xausa, Dec 11 2023 *)
  • PARI
    f(m, p) = {forprime(q=2, precprime(p-1), if (! (m % q), return (m/q));); m*p+1;}
    a(n) = {my(p=prime(n), x=p, list = List()); listput(list, x); while (1, x = f(x, p); for (i=1, #list, if (x == list[i], return (#list - i + 1));); listput(list, x););} \\ Michel Marcus, Jan 12 2021
    
  • Python
    from sympy import prime, primerange
    def a(n):
        P = prime(n)
        x, plst, traj, seen = P, list(primerange(2, P)), [], set()
        while x not in seen:
            traj.append(x)
            seen.add(x)
            x = next((x//p for p in plst if x%p == 0), P*x+1)
        return len(traj) - traj.index(x)
    print([a(n) for n in range(2, 107)]) # Michael S. Branicky, Dec 11 2023

Formula

a(n) = A023514(n)+1 if the cycle contains the number 1. - Jon Maiga, Jan 12 2021

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Nov 08 2000
Corrected by T. D. Noe, Apr 02 2008

A057691 Number of terms before entering cycle in trajectory of P under the 'Px+1' map, where P = n-th prime, or -1 if trajectory does not cycle.

Original entry on oeis.org

5, 13, 4, 10, 25, 11, 68, 14, 39, 34, 9, 4, 5, 5, 16, 16, 234, 23, 16, 5, 11, 5, 63, 116, 18, 18, 33, 288, 47, 29, 317, 14, 12, 61, 60, 6, 16, 10, 5, 14, 46, 5, 6, 15, 105, 4, 11, 48, 44, 5, 6, 10, 5, 55, 15, 14, 25, 17, 9, 16, 6, 7, 26, 5, 33, 46, 5, 16, 23, 13, 15, 11, 16, 14, 11
Offset: 2

Views

Author

N. J. A. Sloane, Oct 20 2000

Keywords

Comments

See A057684 for definition.

Examples

			For n=3, P=7: trajectory of 7 is 7, 50, 25, 5, 1, 8, 4, 2, 1, 8, 4, 2, 1, 8, 4, 2, 1, ..., which has maximal term 50, cycle length 4 and there are 4 terms before it enters the cycle.
		

Crossrefs

Programs

  • Mathematica
    Px1[p_,n_]:=Catch[For[i=1,iPaolo Xausa, Dec 11 2023 *)
  • Python
    from sympy import prime, primerange
    def a(n):
        P = prime(n)
        x, plst, traj, seen = P, list(primerange(2, P)), [], set()
        while x not in seen:
            traj.append(x)
            seen.add(x)
            x = next((x//p for p in plst if x%p == 0), P*x+1)
        return traj.index(x)
    print([a(n) for n in range(2, 82)]) # Michael S. Branicky, Dec 11 2023

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Nov 08 2000

A057684 Trajectory of 13 under the '13x+1' map.

Original entry on oeis.org

13, 170, 85, 17, 222, 111, 37, 482, 241, 3134, 1567, 20372, 10186, 5093, 463, 6020, 3010, 1505, 301, 43, 560, 280, 140, 70, 35, 7, 1, 14, 7, 1, 14, 7, 1, 14, 7, 1, 14, 7, 1, 14, 7, 1, 14, 7, 1, 14, 7, 1, 14, 7, 1, 14, 7, 1, 14, 7, 1, 14, 7, 1, 14, 7
Offset: 0

Views

Author

N. J. A. Sloane, Oct 20 2000

Keywords

Comments

The 'Px+1 map': if x is divisible by any prime < P then divide out these primes one at a time starting with the smallest; otherwise multiply x by P and add 1.

Crossrefs

Programs

  • Maple
    with(numtheory): a := proc(n,S,Q) option remember: local k; if n=0 then RETURN(S); fi: for k from 1 to Q do if a(n-1,S,Q) mod ithprime(k) = 0 then RETURN(a(n-1,S,Q)/ithprime(k)); fi: od: RETURN(ithprime(Q+1)*a(n-1,S,Q)+1) end; # run with S=13 and Q=5.
  • Mathematica
    a[n_, S_, Q_] := a[n, S, Q] = Module[{k}, If[n == 0, S, For[k = 1, k <= Q, k++, If[Mod[a[n-1, S, Q], Prime[k]] == 0, Return[a[n-1, S, Q]/Prime[k]]] ]; Prime[Q+1]*a[n-1, S, Q] + 1]];
    Table[a[n, 13, 5], {n, 0, 60}] (* Jean-François Alcover, Jul 13 2016, adapted from Maple *)

A057685 Trajectory of 19 under the `19x+1' map.

Original entry on oeis.org

19, 362, 181, 3440, 1720, 860, 430, 215, 43, 818, 409, 7772, 3886, 1943, 36918, 18459, 6153, 2051, 293, 5568, 2784, 1392, 696, 348, 174, 87, 29, 552, 276, 138, 69, 23, 438, 219, 73, 1388, 694, 347, 6594, 3297, 1099, 157, 2984, 1492, 746
Offset: 0

Views

Author

N. J. A. Sloane, Oct 20 2000

Keywords

Comments

See A057684 for definition.

Crossrefs

Programs

  • Mathematica
    Px1[p_,n_]:=Catch[For[i=1,iPaolo Xausa, Dec 10 2023 *)

A057686 Trajectory of 23 under the `23x+1' map.

Original entry on oeis.org

23, 530, 265, 53, 1220, 610, 305, 61, 1404, 702, 351, 117, 39, 13, 1, 24, 12, 6, 3, 1, 24, 12, 6, 3, 1, 24, 12, 6, 3, 1, 24, 12, 6, 3, 1, 24, 12, 6, 3, 1, 24, 12, 6, 3, 1, 24, 12, 6, 3, 1, 24, 12, 6, 3, 1, 24, 12, 6, 3, 1, 24, 12, 6, 3, 1, 24, 12, 6, 3, 1
Offset: 0

Views

Author

N. J. A. Sloane, Oct 20 2000

Keywords

Comments

See A057684 for definition.

Crossrefs

Programs

  • Mathematica
    Px1[p_,n_]:=Catch[For[i=1,iPaolo Xausa, Dec 10 2023 *)

A057687 Trajectory of 29 under the `29x+1' map.

Original entry on oeis.org

29, 842, 421, 12210, 6105, 2035, 407, 37, 1074, 537, 179, 5192, 2596, 1298, 649, 59, 1712, 856, 428, 214, 107, 3104, 1552, 776, 388, 194, 97, 2814, 1407, 469, 67, 1944, 972, 486, 243, 81, 27, 9, 3, 1, 30, 15, 5, 1, 30, 15, 5, 1, 30, 15
Offset: 0

Views

Author

N. J. A. Sloane, Oct 20 2000

Keywords

Comments

See A057684 for definition.

Crossrefs

Programs

  • Mathematica
    Px1[p_,n_]:=Catch[For[i=1,iPaolo Xausa, Dec 10 2023 *)

A259207 5x + 1 sequence beginning at 5.

Original entry on oeis.org

5, 26, 13, 66, 33, 166, 83, 416, 208, 104, 52, 26, 13, 66, 33, 166, 83, 416, 208, 104, 52, 26, 13, 66, 33, 166, 83, 416, 208, 104, 52, 26, 13, 66, 33, 166, 83, 416, 208, 104, 52, 26, 13, 66, 33, 166, 83, 416, 208, 104, 52, 26, 13, 66, 33, 166, 83, 416, 208, 104, 52, 26, 13, 66, 33
Offset: 0

Views

Author

Alonso del Arte, Jun 20 2015

Keywords

Comments

It's still not known whether every 3x + 1 sequence reaches 1. But for the 5x + 1 variant, the answer is clearly no, as this sequence demonstrates: 26 is first encountered as 5 * 5 + 1, but every time afterwards as half 52.
However, there are still unanswered questions about the 5x + 1 problem. Kontorovich and Lagarias (2009) say that it is conjectured that there are very few periodic orbits, one of which is the one exhibited by this sequence.

Examples

			5 is odd, so it's followed by 5 * 5 + 1 = 26.
26 is even, so it's followed by 26/2 = 13.
		

Crossrefs

Programs

  • Magma
    [n eq 1 select 5 else IsOdd(Self(n-1)) select 5*Self(n-1)+1 else Self(n-1) div 2: n in [1..100]]; // Vincenzo Librandi, Jun 21 2015
    
  • Mathematica
    NestList[If[EvenQ[#], #/2, 5# + 1] &, 5, 100]
  • PARI
    Vec((5 + 26*x + 13*x^2 + 66*x^3 + 33*x^4 + 166*x^5 + 83*x^6 + 416*x^7 + 208*x^8 + 104*x^9 + 47*x^10) / ((1 - x)*(1 + x)*(1 - x + x^2 - x^3 + x^4)*(1 + x + x^2 + x^3 + x^4)) + O(x^50)) \\ Colin Barker, Oct 04 2019

Formula

a(0) = 5; a(n) = 5*a(n - 1) + 1 if a(n - 1) is odd, a(n) = a(n - 1)/2 otherwise.
From Colin Barker, Oct 04 2019: (Start)
G.f.: (5 + 26*x + 13*x^2 + 66*x^3 + 33*x^4 + 166*x^5 + 83*x^6 + 416*x^7 + 208*x^8 + 104*x^9 + 47*x^10) / ((1 - x)*(1 + x)*(1 - x + x^2 - x^3 + x^4)*(1 + x + x^2 + x^3 + x^4)).
a(n) = a(n-10) for n>10.
(End)
Showing 1-10 of 22 results. Next