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.

A154951 Found by taking the tree defined by the Hofstadter H-sequence (A005374), mirroring it left to right and relabeling the nodes so they increase left to right. a(n) is the parent node of node n in the tree so constructed.

This page as a plain text file.
%I A154951 #10 Mar 07 2020 04:09:57
%S A154951 0,1,1,2,3,4,4,5,6,6,7,8,9,9,10,10,11,12,13,13,14,15,15,16,16,17,18,
%T A154951 19,19,20,21,22,22,23,24,24,25,25,26,27,28,28,29,29,30,31,32,32,33,34,
%U A154951 35,35,36,37,37,38,38,39,40,41,41,42,43,43,44,44,45,46,47,47
%N A154951 Found by taking the tree defined by the Hofstadter H-sequence (A005374), mirroring it left to right and relabeling the nodes so they increase left to right. a(n) is the parent node of node n in the tree so constructed.
%D A154951 D. R. Hofstadter, Goedel, Escher, Bach: an Eternal Golden Braid, Basic Books, 1999, p. 137.
%H A154951 David Fifield <a href="/A154951/b154951.txt">Table of n, a(n) for n = 0..10000</a>
%o A154951 (Python) # Emulate a breadth-first traversal of the "flip"
%o A154951 # of the tree defined by the Hofstadter H-sequence.
%o A154951 def hflip_iter():
%o A154951     yield 0
%o A154951     yield 1
%o A154951     # Start on the first node of a left branch, parent node is 1.
%o A154951     queue = [(1, 1)]
%o A154951     n = 2
%o A154951     while True:
%o A154951         parent, state = queue.pop(0)
%o A154951         yield parent
%o A154951         if state == 0:
%o A154951             # Root node. Add the two children.
%o A154951             queue.append((n, 1))
%o A154951             queue.append((n, 0))
%o A154951         elif state == 1:
%o A154951             # First node on left branch. Add the second node.
%o A154951             queue.append((n, 2))
%o A154951         elif state == 2:
%o A154951             # Second node on left branch. Add a new root.
%o A154951             queue.append((n, 0))
%o A154951         n += 1
%o A154951 i = hflip_iter()
%o A154951 for n in range(0, 10001):
%o A154951     print("%d %d" % (n, next(i)))
%Y A154951 Cf. A005374, A123070.
%K A154951 nonn
%O A154951 0,4
%A A154951 _David Fifield_, Jan 17 2009