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.
%I A338237 #18 Nov 06 2021 02:24:50 %S A338237 1,2,4,6,8,11,15,18,24,30,36,46,54,66,78,94,110,130,154,179,205,240, %T A338237 278,317,365,418,474,539,612,692,783,885,993,1116,1254,1399,1570,1752, %U A338237 1950,2166,2408,2690,2976,3287,3644,4023,4449,4892,5391,5946,6523,7169 %N A338237 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 C - primepi(C) = N, or A062298(C) = N. For a node with two children, the smaller child is assigned as the left child and the bigger one as the right child. Otherwise, the child is assigned as the left child. %C A338237 The binary tree, read from left to right in the order of increasing depth n, is the positive integer sequence A000027. The first 65 numbers in the binary tree are shown in the figure below. %C A338237 1 %C A338237 / \ %C A338237 2 3 %C A338237 / \ / \ %C A338237 4 5 6 7 %C A338237 / / / \ / \ %C A338237 8 9 10 11 12 13 %C A338237 / / / \ / \ / / %C A338237 14 15 16 17 18 19 20 21 %C A338237 / \ / / / / / \ / \ / %C A338237 22 23 24 25 26 27 28 29 30 31 32 %C A338237 / / / / \ / / / \ / \ / / / \ %C A338237 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 %C A338237 / / / / / \ / / / / / \ / \ / / / / %C A338237 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 %C A338237 Every node has either one child or two children and, thus, the binary tree has no leaves. All left children except 2 are composites and all odd primes are right children. %C A338237 a(n) for n >= 1 in this sequence is the number of terms in A090532 having the value of n. %C A338237 The left side of the binary tree is A025003 with a(1) = 1. A025003 is the smallest number that takes n steps to reach 1 when map A062298 is applied to an integer. %C A338237 Starting from the root, there is only one path in which all nodes have two children. The path is 1 -> 3 -> 6 -> 11 -> 19 -> 29 - > 43 -> 60 -> 83, which contains 9 nodes. %H A338237 Michael De Vlieger, <a href="/A338237/b338237.txt">Table of n, a(n) for n = 0..150</a> %t A338237 c = q = 0; w = {}; Do[Set[a[i], If[PrimeQ[i], c++, a[i - c]]]; q++; If[a[i] == 0, AppendTo[w, q]; q = 0], {i, 2, 10^5}]; Most[w] (* _Michael De Vlieger_, Nov 04 2021 *) %o A338237 (Python) %o A338237 from sympy import primepi %o A338237 def depth(k): %o A338237 d = 0 %o A338237 while k > 1: %o A338237 k -= primepi(k) %o A338237 d += 1 %o A338237 return d %o A338237 m = 1 %o A338237 for n in range (0, 101): %o A338237 a = 0 %o A338237 while depth(m + a) == n: %o A338237 a += 1 %o A338237 print(a) %o A338237 m += a %Y A338237 Cf. A000027, A025003, A062298, A090532. %K A338237 nonn %O A338237 0,2 %A A338237 _Ya-Ping Lu_, Oct 17 2020