

A351468


Irregular triangle read by rows where row n is Newey's sequence containing all permutations of 1..n.


3



1, 2, 1, 2, 1, 2, 3, 1, 2, 1, 3, 1, 2, 3, 4, 1, 2, 3, 1, 4, 2, 1, 3, 1, 2, 3, 4, 5, 1, 2, 3, 4, 1, 5, 2, 3, 1, 4, 5, 2, 1, 3, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 1, 6, 2, 3, 4, 1, 5, 6, 2, 3, 1, 4, 5, 6, 2, 1, 3
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

2,2


COMMENTS

Row n contains n^2  2*n + 4 = A117950(n1) terms, numbered as columns k >= 1. Row n contains within it all permutations of 1..n as subsequences. These subsequences need not be consecutive terms (and in general are not).
Newey's construction (section 6) is an initial 1..n then successive term 1 and n2 terms from a rotating block of 2..n. The effect is term 1 at k=1, k=n+1, then steps n1 apart, and the rest filled with repeating 2..n.
Koutas and Hu (equation (1)) form the same by blocks D_k(mn) which start with 1 and then appropriate parts of rotated 2..n like Newey.
Jon E. Schoenfield in A062714 starts from repeated 2..n and inserts 1's.
For n = 3 to 7, Newey shows these sequences are as short as possible (A062714) for any sequence containing all permutations, and noted the "obvious" conjecture that maybe they would be shortest always. But this is not so, since Jon E. Schoenfield gives a shorter n=16 in A062714, and Radomirovic constructs shorter for all n >= 10.


LINKS

Kevin Ryde, Table of n, a(n) for rows 2 .. 30, flattened
P. J. Koutas and T. C. Hu, Shortest String Containing All Permutations, Discrete Mathematics, volume 11, 1975, pages 125132.
Malcolm Newey, Notes on a Problem Involving Permutations as Subsequences, Stanford Artificial Intelligence Laboratory, Memo AIM190, STANCS73340, 1973.


FORMULA

T(n,k) = k for 1 <= k <= n, otherwise.
T(n,k) = 1 if r=0 and q<n, otherwise.
T(n,k) = 2 + ((rq) mod (n1)),
where division q = floor((k2)/(n1)) remainder r = (k2) mod (n1). [Adapted from Jon E. Schoenfield in A062714.]


EXAMPLE

Triangle begins
n=2: 1,2,1,2
n=3: 1,2,3,1,2,1,3
n=4: 1,2,3,4,1,2,3,1,4,2,1,3
n=5: 1,2,3,4,5,1,2,3,4,1,5,2,3,1,4,5,2,1,3
For row n=3, the permutations of 1,2,3 are located within the row as follows (some are present in multiple ways too).
1,2,3,1,2,1,3 row n=3
123 \
132  all permutations
213  of 1,2,3 within
231  row n=3
312 
321 /
For row n=4, see example in A062714.
For row n=5, the pattern of 1's among repeating 2..5 is
2,3,4,5, 2,3,4, 5,2,3, 4,5,2, 3
1, 1, 1, 1, 1,
\/ \/ \/ \/
5 apart, thereafter 4 apart


PROG

(PARI) T(n, k) = if(k<=n, k, my(q, r); [q, r]=divrem(k2, n1); if(r==0&&q<n, 1, 2+(rq)%(n1)));
(PARI) row(n) = my(r=1, t=1); vector((n1)^2+3, i, if(i==1, 1, r++>n, r=1+(n>2); 1, if(t++>n, t=2, t)));


CROSSREFS

Cf. A117950 (row lengths), A062714 (shortest possible).
Cf. A351469 (Adelman's sequences).
Sequence in context: A080237 A136109 A105265 * A193360 A061394 A248141
Adjacent sequences: A351465 A351466 A351467 * A351469 A351470 A351471


KEYWORD

nonn,easy,tabf


AUTHOR

Kevin Ryde, Feb 23 2022


STATUS

approved



