Generalized Hofstadter functions G, H and beyond: numeration systems and discrepancy
Abstract
Hofstadter's G function is recursively defined via G(0)=0 and then G(n)=n-G(G(n-1)). Following Hofstadter, a family (Fk) of similar functions is obtained by varying the number k of nested recursive calls in this equation. We study here some Fibonacci-like sequences that are deeply connected with these functions Fk. In particular, the Zeckendorf theorem can be adapted to provide digital expansions via sums of terms of these sequences. On these digital expansions, the functions Fk are acting as right shifts of the digits. These Fibonacci-like sequences can be expressed in terms of zeros of the polynomial Xk-Xk-1-1. Considering now the discrepancy of each function Fk, i.e., the maximal distance between Fk and its linear equivalent, we retrieve the fact that this discrepancy is finite exactly when k 4. Thanks to that, we solve two twenty-year-old OEIS conjectures stating how close the functions F3 and F4 are from the integer parts of their linear equivalents. Moreover we establish that Fk can coincide exactly with such an integer part only when k 2, while Fk is almost additive exactly when k 4. Finally, a nice fractal shape a la Rauzy has been encountered when investigating the discrepancy of F3. Almost all this article has been formalized and verified in the Coq/Rocq proof assistant.
Turn this paper into a full lesson
ArcXiv compiles a staged curriculum from this paper: 8-12 lessons across beginner → advanced, synthesised section guides, visuals, flashcards, a quiz, exercises, and on-demand deep dives per section. Grounded in the abstract, never invented.