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.

A368464 Number of odd terms in each row of the iterates of the Christmas tree pattern map (A367508).

Original entry on oeis.org

1, 0, 2, 1, 0, 3, 0, 2, 0, 2, 0, 4, 1, 0, 3, 1, 0, 3, 0, 3, 0, 5, 0, 2, 0, 2, 0, 4, 0, 2, 0, 2, 0, 4, 0, 2, 0, 4, 0, 4, 0, 6, 1, 0, 3, 1, 0, 3, 0, 3, 0, 5, 1, 0, 3, 1, 0, 3, 0, 3, 0, 5, 1, 0, 3, 0, 3, 0, 5, 0, 3, 0, 5, 0, 5, 0, 7, 0, 2, 0, 2, 0, 4, 0, 2, 0, 2, 0
Offset: 1

Views

Author

Paolo Xausa, Dec 25 2023

Keywords

Comments

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

Examples

			The first 4 tree pattern orders are shown below (left), with the corresponding number of odd terms on the right.
.
Order 1:                        |
              0  1              |  1
                                |
Order 2:                        |
               10               |  0
           00  01  11           |  2
                                |
Order 3:                        |
            100  101            |  1
            010  110            |  0
       000  001  011  111       |  3
                                |
Order 4:                        |
              1010              |  0
        1000  1001  1011        |  2
              1100              |  0
        0100  0101  1101        |  2
        0010  0110  1110        |  0
  0000  0001  0011  0111  1111  |  4
.
Apparently, removing the 0 terms from the order i pattern (for i >= 2), gives the row lengths of the order i-1 pattern (cf. A363718).
		

Crossrefs

Programs

  • Mathematica
    With[{imax=8},Map[Total,Map[Mod[FromDigits[#],2]&,NestList[Map[Delete[{If[Length[#]>1,Map[#<>"0"&,Rest[#]],Nothing],Join[{#[[1]]<>"0"},Map[#<>"1"&,#]]},0]&],{{"0","1"}},imax-1],{3}],{2}]] (* Generates terms up to order 8 *)
  • 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(1 for b in r if b[-1] == '1')
            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(), 88))) # Michael S. Branicky, Dec 25 2023