A $2$-Regular Sequence That Counts The Divisors of $n^2 + 1$
Anton Shakov
TL;DR
This work identifies a $2$-regular sequence $s(n)$ whose value-multiplicities encode the divisor counts of $m^2+1$ by proving $\#\{n:s(n)=m\}=\tau(m^2+1)$ and deriving a generating function $\sum_{m\ge0} \tau(m^2+1)x^m=\sum_{n\ge1} x^{s(n)}$. A binary integer-pair tree with left/right maps $L(d,m)=(d,m+d)$ and $R(d,m)=(((m+d)^2+1)/d, m+(m^2+1)/d)$ together with an involution provides a combinatorial proof of the counting identity and ties to the $2$-regular recurrence structure of $s(n)$. The paper also investigates further properties, including a row-sum recurrence $r_n=5r_{n-1}-2r_{n-2}$, an explicit row-average formula, a primality criterion for $n^2+1$ via level sets $igl\{m:s(m)=n\bigr\}$, and a Fibonacci-path connection yielding $s(a(n))=F_n$. Overall, the results embed the divisor function $\tau(m^2+1)$ within a $2$-regular framework and reveal structural links to Fibonacci sequences and symmetric tree constructions.
Abstract
We introduce the $2$-regular integer sequence A383066 $= (s(n))_{n \geq 1}$, which begins $0, 1, 1, 2, 3, 3, 2, \ldots$. We prove that the number of occurrences of an integer $m \geq 0$ in this sequence is equal to $τ(m^2+1)$, the number of divisors of $m^2 + 1$. Using this fact, we give a generating function for $τ(m^2+1)$. We also discuss other interesting properties of $s(n)$, including its relationship to the Fibonacci sequence.
