OFFSET
1,3
COMMENTS
See A367508 for the description of the Christmas tree patterns, references and links.
LINKS
Paolo Xausa, Table of n, a(n) for n = 1..13494 (first 15 orders).
EXAMPLE
The following diagram shows the first 4 tree pattern orders, along with the corresponding number of zeros = number of ones.
.
Order 1: |
0 1 | 1
|
Order 2: |
10 | 1
00 01 11 | 3
|
Order 3: |
100 101 | 3
010 110 | 3
000 001 011 111 | 6
|
Order 4: |
1010 | 2
1000 1001 1011 | 6
1100 | 2
0100 0101 1101 | 6
0010 0110 1110 | 6
0000 0001 0011 0111 1111 | 10
.
MATHEMATICA
With[{imax=9}, Map[Total, NestList[Map[Delete[{If[Length[#]>1, Rest[#], Nothing], Join[{First[#]}, #+1]}, 0]&], {{0, 1}}, imax-1], {2}]] (* Generates terms up to order 9 *)
PROG
(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 sum(e.count("1") for e in 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
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Paolo Xausa, Nov 22 2023
STATUS
approved