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.

A381587 a(1) = 1; thereafter the sequence is extended by iteratively appending the run length transform of the reverse of the sequence thus far.

Original entry on oeis.org

1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 3, 1, 1, 1, 2, 1, 3, 1, 1, 1, 3, 1, 1, 1, 2, 1, 3, 1, 3, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 2, 1, 3, 1, 3, 1, 3, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 2, 1, 3, 1, 3, 1, 3, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3
Offset: 1

Views

Author

Neal Gersh Tolunsky, Feb 27 2025

Keywords

Comments

The run length transform replaces each run of consecutive equal values with a single value representing the length of that run.
Is 2 the greatest even number in the sequence?
It appears that the limit of the rows read in reverse equals A306346 (ignoring the initial terms). - Paul D. Hanna, Mar 03 2025

Examples

			Irregular triangle begins:
  1;
  1;
  2;
  1,2;
  1,1,1,2;
  1,3,1,1,1,2;
  1,3,1,1,1,3,1,1,1,2;
  1,3,1,3,1,1,1,3,1,1,1,3,1,1,1,2;
  1,3,1,3,1,3,1,1,1,1,1,3,1,3,1,1,1,3,1,1,1,3,1,1,1,2;
  ...
		

Crossrefs

Cf. A381357 (row lengths), A381358 (row sums), A381356 (limit of rows), A306346.
Cf. A306211.

Programs

  • PARI
    \\ From Paul D. Hanna, Mar 03 2025: (Start)
    \\ RUNS(V) Returns vector of run lengths in vector V:
    {RUNS(V) = my(R=[],c=1);if(#V>1, for(n=2,#V, if(V[n]==V[n-1], c=c+1, R=concat(R,c); c=1))); R=concat(R,c)}
    \\ REV(V) Reverses order of vector V:
    {REV(V) = Vec(Polrev(Ser(V)))}
    \\ Generates N rows as a vector A of row vectors
    {N=15; A=vector(N);A[1]=[1];A[2]=[1];A[3]=[2];
    for(n=3,#A-1, A[n+1] = concat(RUNS(REV(A[n])),A[n]);); A}
    for(n=1,N,print(A[n])) \\ Print N rows of this triangle (End)

A306346 Start with the sequence S(1) = [0], and for n >= 1 define S(n+1) to equal the concatenation of S(n) with the RUNS transform of S(n) when read in reverse order. This sequence is the limit of that process as n goes to infinity.

Original entry on oeis.org

0, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 3, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 5, 1, 1, 1, 3, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 3, 1, 7, 1, 1, 1, 1, 1, 5, 1, 1, 1, 3, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 3, 1, 5, 1, 1, 1, 7, 1, 1, 1, 1, 1, 3, 1, 7, 1
Offset: 1

Views

Author

Michel Lagneau, Feb 09 2019

Keywords

Comments

Conjecture 1: a(n) <= 7.
Conjecture 2: a(n) is odd for n > 1 and when a(n) = 3, 5 or 7, n is odd.
Property of the sequence:
a(n) = 3 for the odd values n = 5, 9, 13, 15, 21, 23, 25, 37, 39, ...
a(n) = 5 for the odd values n = 33, 57, 75, 93, 111, 115, 129, 147, ...
a(n) = 7 for the odd values n = 51, 79, 87, 121, 133, 141, 185, 203, ...
Remark:
If row 1 = [1], the sequence a(n) becomes b(n) = 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 3, 1, 1, 1, 2, 1, 3, 1, 1, 1, 3, 1, 1, 1, 2, 1, 3, 1, 3, 1, 1, 1, ... and it is conjectured that b(n) <= 7.
Statistics for n <= 10^5:
+--------------+-------------------------+------------+
| a(n) | number of occurrences | percentage |
| | for n <= 10^5 | |
+--------------+-------------------------+------------+
| 1 | 72244 | 72.244% |
| 3 | 18030 | 18.030% |
| 5 | 6806 | 6.806% |
| 7 | 2919 | 2.919% |
+--------------+-------------------------+------------+

Examples

			We may consider this sequence to be the limit of the rows of the irregular triangle in which row n+1 equals the concatenation of row n with the RUNS transform of row n when read in reverse order, as illustrated below.
Start with row 1 = [0];
the RUNS of row 1 in reverse = [1], so row 2 = row 1 + [1] = [0, 1];
the RUNS of row 2 in reverse = [1, 1], so row 3 = row 2 + [1, 1] = [0, 1, 1, 1];
the RUNS of row 3 in reverse = [3, 1], so row 4 = row 3 + [3, 1] = [0, 1, 1, 1, 3, 1];
the RUNS of row 4 in reverse = [1, 1, 3, 1], so row 5 = row 4 + [1, 1, 3, 1] = [0, 1, 1, 1, 3, 1, 1, 1, 3, 1];
etc.
The irregular triangle starts:
  [0];
  [0, 1];
  [0, 1, 1, 1];
  [0, 1, 1, 1, 3, 1];
  [0, 1, 1, 1, 3, 1, 1, 1, 3, 1];
  [0, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 3, 1, 3, 1];
  [0, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 3, 1, 3, 1, 3, 1];
  ...
in which the limit of the rows yields this sequence.
The row lengths of the above triangle equal A381357 (offset 3).
		

Crossrefs

Programs

  • Maple
    n0:=1:T:=array(1..1000,[0$1000]):
    for n from 1 to 50 do :
      it:=1:i:=n0:
      for k from n0 by -1 to 2 do:
        if T[k]=T[k-1]
         then
         it:=it+1:
         else
         i:=i+1:T[i]:=it:it:=1:
        fi:
       od:
      i:=i+1:T[i]:=1:n0:=i:
      od:
    print(T):
  • PARI
    \\ From Paul D. Hanna, Mar 04 2025: (Start)
    \\ Print the first N rows of the irregular triangle.
    \\ This sequence equals the limit of the rows.
    \\ RUNS(V) Returns vector of run lengths in vector V:
    {RUNS(V) = my(R=[], c=1); if(#V>1, for(n=2, #V, if(V[n]==V[n-1], c=c+1, R=concat(R, c); c=1))); R=concat(R, c)}
    \\ REV(V) Reverses order of vector V:
    {REV(V) = Vec(Polrev(Ser(V)))}
    \\ Generates N rows as a vector A of row vectors
    {N=12; A=vector(N); A[1]=[0];
    for(n=1, #A-1, A[n+1] = concat(A[n], RUNS(REV(A[n]))); );}
    for(n=1,N,print(A[n])) \\ (End)

Extensions

Name corrected and edited by Paul D. Hanna, Mar 05 2025
Showing 1-2 of 2 results.