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).
LINKS
Peter Luschny, A SageMath notebook for A368279 and A369492, Jan. 2024
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
KEYWORD
nonn,tabl
AUTHOR
Peter Luschny, Jan 25 2024
STATUS
approved