login
A395081
Triangle read by rows: row n (n >= 1) gives the concatenated run-length encoding of the integer partitions of n, sorted as in A334442.
1
1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 1, 1, 3, 4, 1, 1, 1, 3, 1, 2, 2, 1, 2, 2, 1, 1, 4, 5, 1, 1, 1, 4, 1, 2, 1, 3, 1, 1, 2, 3, 1, 1, 1, 2, 2, 1, 3, 2, 1, 1, 5, 6, 1, 1, 1, 5, 1, 2, 1, 4, 1, 3, 2, 1, 2, 4, 1, 1, 1, 2, 1, 3, 1, 2, 3, 1, 3, 3, 1, 1, 2, 2, 2, 1, 4, 2, 1, 1, 6
OFFSET
1,3
COMMENTS
Each partition lambda is represented as a flat list [v_1, m_1, v_2, m_2, ...] where v_i is the part value and m_i is its multiplicity.
EXAMPLE
[1] [1, 1]
[2] [2, 1, 1, 2]
[3] [3, 1, 1, 1, 2, 1, 1, 3]
[4] [4, 1, 1, 1, 3, 1, 2, 2, 1, 2, 2, 1, 1, 4]
[5] [5, 1, 1, 1, 4, 1, 2, 1, 3, 1, 1, 2, 3, 1, 1, 1, 2, 2, 1, 3, 2, 1, 1, 5]
PROG
(Python)
def A395081(n: int) -> list[list[int]]:
""" Returns a list of lists, where each inner list is a flat representation:
[value_1, multiplicity_1, value_2, multiplicity_2, ...] """
def gen(n, i): # Generator
if n == 0: yield []
elif i == 1: yield [1, n]
else:
if n >= i:
for p in gen(n - i, min(n - i, i)):
if p and p[-2] == i:
new_p = list(p)
new_p[-1] += 1
yield new_p
else:
yield p + [i, 1]
yield from gen(n, i - 1)
if n == 0: return [[]]
partitions = list(gen(n, n))
# Sort by length: length is sum of multiplicities (every second element)
partitions.sort(key=lambda p: sum(p[1::2]))
return partitions
A395081row = lambda n: [p for parts in A395081(n) for p in parts] # flatten
for n in range(1, 8): print([n], A395081row(n))
CROSSREFS
Sequence in context: A309736 A368010 A237453 * A383134 A265754 A089309
KEYWORD
nonn,tabf
AUTHOR
Peter Luschny, May 02 2026
EXTENSIONS
Name edited and offset set to 1 by Peter Luschny, May 13 2026
STATUS
approved