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
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;
...
-
\\ 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
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).
-
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):
-
\\ 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)
Showing 1-2 of 2 results.
Comments