A367562 Iterates of the Christmas tree pattern map (A367508), read by rows and converted to decimal.
0, 1, 2, 0, 1, 3, 4, 5, 2, 6, 0, 1, 3, 7, 10, 8, 9, 11, 12, 4, 5, 13, 2, 6, 14, 0, 1, 3, 7, 15, 20, 21, 18, 22, 16, 17, 19, 23, 24, 25, 10, 26, 8, 9, 11, 27, 12, 28, 4, 5, 13, 29, 2, 6, 14, 30, 0, 1, 3, 7, 15, 31, 42, 40, 41, 43, 44, 36, 37, 45, 34, 38, 46, 32, 33, 35, 39, 47
Offset: 1
Examples
The first 4 tree pattern orders are shown below (on the right their elements are converted to decimal: the present sequence is obtained by reading the right half of the diagram left to right, top to bottom). The sequence of the terms in chains of length 1 (marked with asterisks) coincides with the positive terms of A014486. . Order 1: | 0 1 | 0 1 | Order 2: | 10 | 2* 00 01 11 | 0 1 3 | Order 3: | 100 101 | 4 5 010 110 | 2 6 000 001 011 111 | 0 1 3 7 | Order 4: | 1010 | 10* 1000 1001 1011 | 8 9 11 1100 | 12* 0100 0101 1101 | 4 5 13 0010 0110 1110 | 2 6 14 0000 0001 0011 0111 1111 | 0 1 3 7 15 .
Links
- Paolo Xausa, Table of n, a(n) for n = 1..8190 (first 12 orders, flattened).
Programs
-
Mathematica
With[{imax=6},Map[FromDigits[#,2]&,NestList[Map[Delete[{If[Length[#]>1,Map[#<>"0"&,Rest[#]],Nothing],Join[{#[[1]]<>"0"},Map[#<>"1"&,#]]},0]&],{{"0","1"}},imax-1],{3}]] (* Generates terms up to order 6 *)
-
Python
from itertools import islice from functools import reduce def uniq(r): return reduce(lambda u, e: u if e in u else u+[e], r, []) def agen(): # generator of terms R = [["0", "1"]] while R: r = R.pop(0) yield from map(lambda b: int(b, 2), r) if len(r) > 1: R.append(uniq([r[k]+"0" for k in range(1, len(r))])) R.append(uniq([r[0]+"0", r[0]+"1"] + [r[k]+"1" for k in range(1, len(r))])) print(list(islice(agen(), 77))) # Michael S. Branicky, Nov 23 2023
Comments