login
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.
0
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,2
EXAMPLE
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.
PROG
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Ya-Ping Lu, Oct 24 2020
STATUS
approved