A123070 Hofstadter Flip-G-sequence.
0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 11, 12, 13, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 19, 20, 21, 21, 22, 23, 23, 24, 24, 25, 26, 26, 27, 27, 28, 29, 29, 30, 31, 31, 32, 32, 33, 34, 34, 35, 35, 36, 37, 37, 38, 39, 39, 40, 40, 41, 42, 42, 43, 44
Offset: 0
References
- D. Hofstadter, "Goedel, Escher, Bach", p. 137.
Links
- David Fifield, Table of n, a(n) for n = 0..10000
- Alan Michael Gómez Calderón, A Proof for a Hofstadter Flip-G-sequence Closed-form formula
- Alan Michael Gómez Calderón, A Proof using Walnut for a Hofstadter Flip-G-sequence Closed-form formula
- Pierre Letouzey, Hofstadter's problem for curious readers, technical report, 2015.
- Physics Forum Discussion, Recursive Trees (from GED).
- Jeffrey Shallit, Fibonacci automaton for the Flip-G sequence.
- Index entries for sequences from "Goedel, Escher, Bach"
- Index entries for Hofstadter-type sequences
Programs
-
Mathematica
a[n_] := a[n] = Switch[n, 0, 0, 1, 1, 2, 1, 3, 2, _, (n+1) - a[a[n-1]+1]]; a /@ Range[0, 100] (* Jean-François Alcover, Nov 16 2019 *)
-
Python
# Emulate a breadth-first traversal of the tree defining the "flip-tree" of the Hofstadter G-sequence. def gflip_iter(): yield 0 yield 1 # Start on a left-branch node, parent node is 1. queue = [(1, 1)] n = 2 while True: parent, state = queue.pop(0) yield parent if state == 0: # Root node. Add the two children. queue.append((n, 1)) queue.append((n, 0)) elif state == 1: # Left-branch node. Add a new root. queue.append((n, 0)) n += 1 i = gflip_iter() for n in range(0, 10001): print("%d %d" % (n, next(i))) # David Fifield (david(AT)bamsoftware.com), Jan 17 2009
Formula
Conjecture: a(0) = 0, a(1) = 1, a(2) = 1, a(3) = 2; a(n) = (n+1) - a(a(n-1)+1) for n>=4. [Conjecture has been proved; see Letouzey link. - Pierre Letouzey, Sep 09 2015]
Conjecture: a(0) = 0, a(1) = 1, a(2) = 1, a(3) = 2; for n>=4, let T = n-a(n-1). If T = (n-1) - a((n-1)-1) then a(n) = max{a-inv(T)} otherwise a(n) = min{a-inv(T)}, where a-inv(n) is the inverse of a(n).
From Pierre Letouzey, Sep 09 2015: (Start)
Alternative definition via differences:
a(0) = 0; a(n+1) = a(n) + d(n) where:
d(0) = 1, d(1) = 0, d(2) = 1, d(3) = 1; d(n)=1-d(n-1)*d(a(n)) for n>=4.
Also satisfies: a(n-1)+a(a(n)) = n for n>=4.
a(n) = A005206(n) + e(n), where e(n) is 0 or 1 depending of the shape of the decomposition of n as sums of Fibonacci numbers via Zeckendorf's theorem. (End)
There is an 11-state Fibonacci automaton that generates the sequence a(n) as follows: the inputs are the Zeckendorf representations of n and x in parallel, and the automaton accepts if and only if x = a(n). See the file a123070.pdf in the "links" section above. - Jeffrey Shallit, Feb 19 2025
a(n) = A005206(n - 3) + 2, for n >= 3; a(n) = n - floor((n - 2)/(1 + phi)) - 1, where phi is the golden ratio (1 + sqrt(5))/2 = (A001622). - Alan Michael Gómez Calderón, Aug 05 2025
Comments