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.

Showing 1-1 of 1 results.

A338409 a(n) is the number of nodes with depth of n in a binary tree defined as: root = 1 and a child (C) of a node (N) is such that A338215(C) = N. For nodes with two children, the smaller child is assigned as the left child and the bigger one as the right child. A child of a one-child node is assigned as the left child.

Original entry on oeis.org

1, 2, 2, 2, 1, 1, 2, 2, 2, 2, 3, 3, 2, 2, 2, 3, 2, 3, 4, 3, 4, 3, 4, 4, 4, 4, 6, 6, 5, 6, 4, 4, 6, 7, 7, 6, 7, 6, 5, 4, 6, 7, 8, 8, 8, 8, 10, 8, 8, 8, 9, 10, 8, 9, 11, 13, 11, 9, 12, 11, 10, 11, 11, 11, 13, 11, 14, 14, 13, 15, 17, 15, 16, 16, 16, 14, 14, 14
Offset: 0

Views

Author

Ya-Ping Lu, Oct 24 2020

Keywords

Examples

			The binary tree, read from left to right in the order of increasing depth n, is the positive integer sequence A000027. The first 67 numbers are shown in the figure below.
    1
  (2)\_3
     (4)\_5
         6 \_(7)
        8
       9
    (10)\_11
         12 \___________13
        14            (15)
       16 \______17
     (18)\_19   20
          21   22 \_(23)
         24   25
       (26)  27
            28 \______29
           30 \_(31) 32
          33        34
         35        36 \_____________________37
       (38)       39                       40 \_(41)
                 42 \______43             44
                45        46 \______47  (48)
               49        50        51
              52 \_(53) 54        55
            (56)       57        58 \_(59)
                      60 \_(61) 62   63
                     64        65   66 \_67
All left children except 2 are composite numbers and all prime numbers are right children.
		

Crossrefs

Programs

  • Python
    from sympy import primepi
    def depth(k):
        d = 0
        while k > 1:
            k -= primepi(k)
            k += primepi(k)
            d += 1
        return d
    m = 1
    for n in range (0, 101):
        a = 0
        while depth(m + a) == n:
            a += 1
        print(a)
        m += a
Showing 1-1 of 1 results.