[go: up one dir, main page]

login
A369492
Triangle read by rows. An encoding of compositions of n where the first part is the largest part and the last part is not 1. The number of these compositions (the length of row n) is given by A368279.
2
1, 0, 2, 4, 8, 10, 16, 18, 22, 32, 34, 36, 38, 42, 46, 64, 66, 68, 70, 74, 76, 78, 86, 90, 94, 128, 130, 132, 134, 136, 138, 140, 142, 146, 148, 150, 154, 156, 158, 170, 174, 182, 186, 190, 256, 258, 260, 262, 264, 266, 268, 270, 274, 276, 278, 280, 282, 284, 286
OFFSET
0,3
COMMENTS
The compositions are in reverse lexicographic order (see A066099).
For n = 0 we get the empty composition, which we encode by 1.
For n = 1 we get the no composition, which we encode by 0.
The definition uses two filter conditions: (a) 'the last part of the composition is not 1' and (b) 'the first part is the largest part'. By changing condition (b) to (b'), 'the parts are nonincreasing', one obtains A002865. Like the current sequence, A002865 has offset 0; the empty composition is nonincreasing (a(0) = 1), and there is no composition of 1, which has a last part that is not 1 (a(1) = 0).
EXAMPLE
Encoding the composition as an integer, a binary string, a Dyck path, and a list.
[ n]
[ 0] 1 | 1 | () | [()]
[ 1] 0 | 0 | . | []
[ 2] 2 | 10 | (()) | [2]
[ 3] 4 | 100 | ((())) | [3]
[ 4] 8 | 1000 | (((()))) | [4]
[ 5] 10 | 1010 | (())(()) | [2, 2]
[ 6] 16 | 10000 | ((((())))) | [5]
[ 7] 18 | 10010 | ((()))(()) | [3, 2]
[ 8] 22 | 10110 | (())()(()) | [2, 1, 2]
[ 9] 32 | 100000 | (((((()))))) | [6]
[10] 34 | 100010 | (((())))(()) | [4, 2]
[11] 36 | 100100 | ((()))((())) | [3, 3]
[12] 38 | 100110 | ((()))()(()) | [3, 1, 2]
[13] 42 | 101010 | (())(())(()) | [2, 2, 2]
[14] 46 | 101110 | (())()()(()) | [2, 1, 1, 2]
Sequence seen as table:
[0] 1;
[1] 0;
[2] 2;
[3] 4;
[4] 8, 10;
[5] 16, 18, 22;
[6] 32, 34, 36, 38, 42, 46;
[7] 64, 66, 68, 70, 74, 76, 78, 86, 90, 94;
...
PROG
(SageMath) # See the notebook in the links section, that includes a time and space efficient algorithm to generate the compositions. Alternatively, using SageMath's generator:
def pr(bw, w, dw, c):
print(f"{bw:3d} | {str(w).ljust(7)} | {str(dw).ljust(14)} | {c}")
def Trow(n):
row, count = [], 0
for c in reversed(Compositions(n)):
if c == []:
count = 1
pr(1, 1, "()", "[()]")
elif c == [1]:
pr(0, 0, ".", "[]")
elif c[-1] != 1:
if all(part <= c[0] for part in c):
w = Words([0, 1])(c.to_code())
dw = DyckWord(sum([[1]*a + [0]*a for a in c], []))
bw = int(str(w), 2)
row.append(bw)
count += 1
pr(bw, w, dw, c)
# print(f"For n = {n} there are {count} composition of type A369492.")
return row
for n in range(0, 7): Trow(n)
CROSSREFS
Subsequences: A000079, A052548\{3,6}, A369491.
Sequence in context: A085406 A022340 A356843 * A339608 A268497 A093886
KEYWORD
nonn,tabl
AUTHOR
Peter Luschny, Jan 25 2024
STATUS
approved