login
Decimal encoding T(n,k) of the k-th non-averaging permutation of [n]; triangle T(n,k), n >= 0, k = 1..A003407(n), read by rows.
5

%I #41 Dec 09 2017 10:41:11

%S 0,1,12,21,132,213,231,312,1324,1342,2143,2413,2431,3124,3142,3412,

%T 4213,4231,15324,15342,21453,24153,24315,24351,24513,31254,31524,

%U 31542,35124,35142,35412,42153,42315,42351,42513,45213,51324,51342,153264,153426,153462

%N Decimal encoding T(n,k) of the k-th non-averaging permutation of [n]; triangle T(n,k), n >= 0, k = 1..A003407(n), read by rows.

%C A non-averaging permutation avoids any 3-term arithmetic progression.

%C The encoding of the empty permutation () is 0. For positive n each element in the permutation is encoded using 1+floor(log_10(n)) = A055642(n) digits with leading 0's if necessary. Then all elements are concatenated.

%C All terms are in increasing order.

%H Alois P. Heinz, <a href="/A292523/b292523.txt">Rows n = 0..14, flattened</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/NonaveragingSequence.html">Nonaveraging Sequence</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Arithmetic_progression">Arithmetic progression</a>

%H <a href="/index/No#non_averaging">Index entries related to non-averaging sequences</a>

%e Triangle T(n,k) begins:

%e : 0;

%e : 1;

%e : 12, 21;

%e : 132, 213, 231, 312;

%e : 1324, 1342, 2143, 2413, 2431, 3124, 3142, 3412, 4213, 4231;

%e : 15324, 15342, 21453, 24153, ..., 42513, 45213, 51324, 51342;

%e : 153264, 153426, 153462, 153624, ..., 624153, 624315, 624351, 624513;

%e : 1532764, 1537264, 1537426, ..., 7351462, 7351624, 7356124;

%e : 15327648, 15327684, 15372648, ..., 84627351, 84672315, 84672351;

%e : 195327648, 195327684, 195372648, ..., 915738462, 915783426, 915783462;

%e : 1090503020710060408, ..., 10020608090401050703;

%e : 109050302110710060408, ..., 1103070910010502060804;

%e : 10905031107021006041208, ..., 120408100206110307090105;

%p T:= proc(n) option remember; local b, l, c; b, l, c:=

%p proc(s, p) local ok, i, j, k;

%p if nops(s) = 0 then l:= [l[], parse(p)]

%p else for j in s do ok, i, k:= true, j-1, j+1;

%p while ok and i>0 and k<=n do ok, i, k:=

%p not i in s xor k in s, i-1, k+1 od;

%p `if`(ok, b(s minus {j}, cat(p, 0$(c-length(j)), j)), 0)

%p od

%p fi

%p end, [], length(n); b({$1..n}, "0"): sort(l)[]

%p end:

%p seq(T(n), n=0..6);

%Y Cf. A003407, A030299, A055642, A088370.

%K nonn,tabf,base

%O 0,3

%A _Alois P. Heinz_, Dec 08 2017