login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Irregular triangle read by rows: T(n,k) is the position of k within the Christmas tree pattern (A367562) of order n, with n >= 1 and k >= 0.
4

%I #18 Dec 28 2023 15:04:13

%S 1,2,2,3,1,4,5,6,3,7,1,2,4,8,12,13,9,14,6,7,10,15,2,3,1,4,5,8,11,16,

%T 27,28,23,29,19,20,24,30,13,14,11,15,17,21,25,31,5,6,3,7,1,2,4,8,9,10,

%U 12,16,18,22,26,32,58,59,53,60,48,49,54,61,40,41,37,42,45

%N Irregular triangle read by rows: T(n,k) is the position of k within the Christmas tree pattern (A367562) of order n, with n >= 1 and k >= 0.

%C Row n is a permutation of the integers in the interval [1, 2^n].

%C See A367508 for the description of the Christmas tree patterns, references and links.

%H Paolo Xausa, <a href="/A368400/b368400.txt">Table of n, a(n) for n = 1..8190</a> (rows 1..12 of the triangle, flattened).

%e Triangle begins:

%e .

%e n\k| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ...

%e --------------------------------------------------------

%e 1 | 1 2

%e 2 | 2 3 1 4

%e 3 | 5 6 3 7 1 2 4 8

%e 4 | 12 13 9 14 6 7 10 15 2 3 1 4 5 8 11 16

%e ...

%e For example, the order 3 of the Christmas tree pattern is the following (binary on the left, converted to decimal in the middle, position within the pattern on the right):

%e .

%e 100 101 | 4 5 | 1 2

%e 010 110 | 2 6 | 3 4

%e 000 001 011 111 | 0 1 3 7 | 5 6 7 8

%e .

%e The position of the elements within the pattern is therefore the following:

%e .

%e Element: 0 1 2 3 4 5 6 7

%e | | | | | | | |

%e V V V V V V V V

%e Position: 5 6 3 7 1 2 4 8

%e .

%t A367562list[imax_]:=Map[FromDigits[#,2]&,NestList[Map[Delete[{If[Length[#]>1,Map[#<>"0"&,Rest[#]],Nothing],Join[{#[[1]]<>"0"},Map[#<>"1"&,#]]},0]&],{{"0","1"}},imax-1],{3}];

%t With[{nmax=6},Map[Flatten[Values[KeySort[PositionIndex[Flatten[#]]]]]&,A367562list[nmax]]]

%Y Cf. A367508, A367562, A368399.

%K nonn,base,tabf,look

%O 1,2

%A _Paolo Xausa_, Dec 23 2023