cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A368400 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.

Original entry on oeis.org

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, 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, 12, 16, 18, 22, 26, 32, 58, 59, 53, 60, 48, 49, 54, 61, 40, 41, 37, 42, 45
Offset: 1

Views

Author

Paolo Xausa, Dec 23 2023

Keywords

Comments

Row n is a permutation of the integers in the interval [1, 2^n].
See A367508 for the description of the Christmas tree patterns, references and links.

Examples

			Triangle begins:
.
  n\k|  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 ...
  --------------------------------------------------------
   1 |  1  2
   2 |  2  3  1  4
   3 |  5  6  3  7  1  2  4  8
   4 | 12 13  9 14  6  7 10 15  2  3  1  4  5  8 11 16
  ...
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):
.
      100 101     |   4 5   |   1 2
      010 110     |   2 6   |   3 4
  000 001 011 111 | 0 1 3 7 | 5 6 7 8
.
The position of the elements within the pattern is therefore the following:
.
  Element:  0  1  2  3  4  5  6  7
            |  |  |  |  |  |  |  |
            V  V  V  V  V  V  V  V
  Position: 5  6  3  7  1  2  4  8
.
		

Crossrefs

Programs

  • Mathematica
    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}];
    With[{nmax=6},Map[Flatten[Values[KeySort[PositionIndex[Flatten[#]]]]]&,A367562list[nmax]]]