A351468 Irregular triangle read by rows where row n is Newey's sequence containing all permutations of 1..n.
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
Offset: 2
Examples
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 1-2-3 \ 1---3---2 | all permutations 2-1-3 | of 1,2,3 within 2-3-1 | row n=3 3-1-2 | 3---2-1 / 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
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 125-132.
- Malcolm Newey, Notes on a Problem Involving Permutations as Subsequences, Stanford Artificial Intelligence Laboratory, Memo AIM-190, STAN-CS-73-340, 1973.
Crossrefs
Programs
-
PARI
T(n,k) = if(k<=n,k, my(q,r);[q,r]=divrem(k-2,n-1); if(r==0&&q
-
PARI
row(n) = my(r=1,t=1); vector((n-1)^2+3,i, if(i==1,1, r++>n,r=1+(n>2);1, if(t++>n,t=2, t)));
Formula
T(n,k) = k for 1 <= k <= n, otherwise.
T(n,k) = 1 if r=0 and q
T(n,k) = 2 + ((r-q) mod (n-1)),
where division q = floor((k-2)/(n-1)) remainder r = (k-2) mod (n-1). [Adapted from Jon E. Schoenfield in A062714.]
Comments