English

Generalized Hofstadter functions $G, H$ and beyond: numeration systems and discrepancy

Discrete Mathematics 2025-04-14 v5 Formal Languages and Automata Theory Logic in Computer Science Combinatorics Number Theory

Abstract

Hofstadter's GG function is recursively defined via G(0)=0G(0)=0 and then G(n)=nG(G(n1))G(n)=n-G(G(n-1)). Following Hofstadter, a family (Fk)(F_k) of similar functions is obtained by varying the number kk of nested recursive calls in this equation. We study here some Fibonacci-like sequences that are deeply connected with these functions FkF_k. 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 FkF_k are acting as right shifts of the digits. These Fibonacci-like sequences can be expressed in terms of zeros of the polynomial XkXk11X^k{-}X^{k-1}{-}1. Considering now the discrepancy of each function FkF_k, i.e., the maximal distance between FkF_k and its linear equivalent, we retrieve the fact that this discrepancy is finite exactly when k4k \le 4. Thanks to that, we solve two twenty-year-old OEIS conjectures stating how close the functions F3F_3 and F4F_4 are from the integer parts of their linear equivalents. Moreover we establish that FkF_k can coincide exactly with such an integer part only when k2k\le 2, while FkF_k is almost additive exactly when k4k \le 4. Finally, a nice fractal shape a la Rauzy has been encountered when investigating the discrepancy of F3F_3. Almost all this article has been formalized and verified in the Coq/Rocq proof assistant.

Cite

@article{arxiv.2502.12615,
  title  = {Generalized Hofstadter functions $G, H$ and beyond: numeration systems and discrepancy},
  author = {Pierre Letouzey},
  journal= {arXiv preprint arXiv:2502.12615},
  year   = {2025}
}

Comments

(v2: add missing files for latex compilation)(v3: add reference to Dilcher 1993 as important previous work; improved results e.g. split positive and negative discrepancies)(v4: same text, force upload of correct title to arxiv metadata)(v5: much better approximations of $\Delta_3$ and $\Delta_4$, a middle proof via Lagrange instead of Vandermonde)

R2 v1 2026-06-28T21:48:22.417Z