[go: up one dir, main page]

login
A367251
Lexicographically earliest sequence starting 1,2 which can be arranged in a mirror symmetric array shape such that a(n) is the length of the n-th row and no column has the same value more than once.
1
1, 2, 1, 2, 1, 2, 3, 3, 3, 1, 4, 1, 2, 5, 2, 3, 6, 3, 7, 1, 4, 4, 1, 8, 5, 5, 1, 4, 9, 4, 1, 6, 6, 5, 10, 5, 1, 2, 7, 7, 2, 1, 6, 11, 6, 1, 2, 7, 12, 7, 2, 1, 13, 3, 8, 8, 3, 4, 9, 9, 4, 14, 1, 2, 5, 10, 10, 5, 2, 1, 3, 8, 15, 8, 3, 4, 9, 16, 9, 4, 17, 6, 11, 11, 6, 1, 2, 5, 10, 18, 10
OFFSET
1,2
COMMENTS
For row 5 onward, the row contents are mirror symmetric too (palindromes), as well as the shape.
Terms in the same column are successive positive integers (with some initial exceptions before row 5).
EXAMPLE
Array (or "tree") begins, with mirror symmetry in row 5 and beyond:
columns v v v v v v v
row 1: 1,
row 2: 2, 1,
row 3: 2,
row 4: 1, 2,
row 5: 3,
row 6: 3, 3,
row 7: 1, 4, 1,
row 8: 2, 5, 2,
row 9: 3, 6, 3,
row 10: 7,
row 11: 1, 4, 4, 1,
row 12: 8,
row 13: 5, 5,
PROG
(MATLAB)
function a = A367251( max_n )
a = [1 2 1 2 1 2];
odd = zeros(1, max_n); even = odd;
odd(1) = 2; even(1)= 2; c = 5;
while length(a) < max_n
if mod(a(c), 2) == 1
odd(1:(a(c)+1)/2) = odd(1:(a(c)+1)/2)+1;
a = [a odd((a(c)+1)/2:-1:2) odd(1:(a(c)+1)/2)];
else
even(1:a(c)/2) = even(1:a(c)/2)+1;
a = [a even(a(c)/2:-1:1) even(1:a(c)/2)];
end
c = c + 1;
end
end % Thomas Scheuerle, Nov 21 2023
CROSSREFS
Sequence in context: A249717 A249718 A244518 * A161310 A161244 A161029
KEYWORD
nonn,tabf
AUTHOR
Neal Gersh Tolunsky, Nov 11 2023
STATUS
approved