\section{Valuations in base four}\label{four} \subsection{The linear term of the logarithm} We begin with a calculation that covers the highly divisible parameters for any prime-power base. \begin{theorem}\label{primepower} Let \(k=p^a,\ a\ge1,\ m>0,\ s=\nu_p(m)\). If \(p=2\) assume \(s\ge a\); if \(p\) is odd assume \(s\ge a-1\). For every \(n>0\), \[ \nu_p(S_{p^a,m}(n))=s+a-(\nu_p(n)\bmod a). \] Consequently the sequence is bounded and \(p\)-automatic, including its value zero at index zero. \end{theorem} \begin{proof} Write \(n=p^h q,\ p\nmid q\) and \(l=\lfloor h/a\rfloor\). In \(\Q[[x]]\), \[ [x^n]\log D_{k,1}= \frac{1+(k-1)\sum_{i=0}^l k^i}{n}=\frac{p^{a-(h\bmod a)}}q . \] Thus the positive-degree coefficients lie in \(p\Z_{(p)}\), where denominators in \(\Z_{(p)}\) are prime to \(p\). The degree-\(j\) exponential term in \(\exp(m\log D_{k,1})\) lies coefficientwise in \(p^{j(s+1)-\nu_p(j!)}\Z_{(p)}\). For \(j\ge2\), Legendre's formula gives \(\nu_p(j!)\le j-1\). For odd \(p\) it gives \(\nu_p(j!)\le j-2\), directly at \(j=2\) and from \((j-1)/(p-1)\) at \(j\ge3\). The bounds on \(s\) make the exponent at least \(s+a+1\) in all higher terms. Only finitely many terms enter each coefficient. The linear term has the asserted valuation. A finite automaton reading base-\(p\) digits counts trailing zeros modulo \(a\), resetting the count at each nonzero digit and remembering whether a nonzero digit has occurred. \end{proof} Set \(D_m=D_{4,m}\), \(h=\vnu(n)\) and \(q=n/2^h\) from now on. Write \(L=\frac12\log D_1\). The calculation above gives \begin{equation}\label{ell} [x^n]L=2^{1-(h\bmod2)}/q . \end{equation} For \(4\mid m\), Theorem~\ref{primepower} gives the first row of Theorem~\ref{main66}. \subsection{The inverse series and odd colors}\label{oddcolors} Let \(m\) be odd, \(m>0\), and \(b=\vnu(m+1)\). All exponential terms of order at least two in \(D_{m+1}\) vanish modulo \(2^{2b+1}\), hence modulo \(2^{b+2}\). Meanwhile \[ D_{-1}=(1-x)\prod_{i\ge0}(1-x^{4^i})^3\equiv1\pmod2: \] the cubed factors reduce to digit polynomials \(1+z+z^2+z^3\), with \(z=x^{4^i}\). Together they generate \(1/(1-x)\) modulo two. As \(D_m=D_{-1}D_{m+1}\), this gives \begin{equation}\label{inverse} D_m\equiv D_{-1}+2(m+1)L\pmod{2^{b+2}} . \end{equation} The coefficient \(P_n=[x^n]D_{-1}/(1-x)\) is the product of the weights of the base-four digits of \(n\), with weights \(w_0,w_1,w_2,w_3=1,-3,3,-1\), respectively. For \(n=4^t(4u+r)\), \(1\le r\le3\), \[ [x^n]D_{-1}=P_n-P_{n-1}=P_u(w_r-(-1)^t w_{r-1}). \] For even \(t\) the three parentheses are \(-4,6,-4\), and for odd \(t\) they are \(-2,0,2\). Since \(P_u\) is odd, the inverse coefficient has valuation 2 when \(h\equiv0\bmod4\), valuation 1 when \(h\equiv1,2\bmod4\), and vanishes when \(h\equiv3\bmod4\). In the first case \([x^n]L\) is even, so \eqref{inverse} preserves valuation 2 even at \(b=1\). In the next two classes it preserves valuation 1. In the final case \([x^n]L\) is odd and the answer is \(b+1\). \subsection{Twice an odd number of colors} Write \(m=2u\) with \(u\) odd. Expanding \(\exp(4uL)\) gives \begin{equation}\label{twice} D_{2u}\equiv1+4uL+8u^2L^2\pmod{32}. \end{equation} Indeed \(2j-\vnu(j!)\ge j+1\) for \(j\ge4\), and the exponent at \(j=3\) is 5. When \(h\) is odd the linear term has valuation 2 and the quadratic term is divisible by eight. When \(h=0\) the linear term has valuation 3, and the square has even coefficient at the odd index \(n\). This gives valuation 3 there. For even \(h\ge2\), split \(L=L_{\mathrm{odd}}+L_{\mathrm{even}}\) according to the parity of the \emph{index valuation}. The coefficients of \(L_{\mathrm{even}}\) are even, so \(L^2\equiv L_{\mathrm{odd}}^2\bmod4\). The diagonal at \(n/2\) contributes 1 modulo four. For \(i0\). Direct cancellation in \eqref{product} gives \[ D_m(x)=H(x)^{2m}H(x^2)^mD_m(x^4). \] Reading low binary digits alternates \(e=2m,m\), beginning with \(2m\). Indeed \(\Lambda_d\) pulls an \(x^2\)-series out of the product. The unused tail (also at odd lengths) has constant coefficient 1, so the value of a final section polynomial at \(y=1\) is the actual coefficient for that digit word. For \(\ell\ge0\), the polynomials \(J_{\ell,d}=\Lambda_d(y^\ell)\) obey \[ J_{\ell,d}=2yJ_{\ell-1,d}-yJ_{\ell-2,d}\quad(\ell\ge2),\qquad (J_{0,0},J_{0,1})=(1,0),\quad J_{1,0}=J_{1,1}=y . \] To see this, set \(z^2=x\). The sections are the half-sum and the difference divided by \(2z\) of \((1-z)^{-\ell}\) and \((1+z)^{-\ell}\); the two bases have sum \(2y\) and product \(y\). Induction gives \begin{equation}\label{weights} [y^i]J_{\ell,d}=0\quad(\ell>2i),\qquad 2^{\max(0,2i-\ell-1)}\mid [y^i]J_{\ell,d}. \end{equation} For the first property use the recurrence at \(i-1\); for the second, its first term contributes a factor two and the second already has the required weight. Let \(\mathcal L\) be the lattice of polynomials \(g=\sum_{i\ge1}g_i y^i\) with \(2^{i-1}\mid g_i\). For input in \(\Z+\mathcal L\), the binomial coefficients of \(H^e\) show that the product at degree \(\ell\) is divisible by \(2^{\max(0,\ell-1)}\). Thus the output at degree \(i\ge1\) is divisible by \(2^{2i-2}\): for \(1\le\ell<2i\) the two weights add to \(2i-2\), and at \(\ell=2i\) the product alone suffices. The term \(\ell=0\) contributes only to the constant. Both operators preserve a zero polynomial constant, and the odd section always has zero constant. Impose the further conditions \begin{equation}\label{shape} g_1\equiv0\pmod2,\qquad g_2\equiv2\pmod4,\qquad g_3\equiv0\pmod8 . \end{equation} Every coefficient of such \(g\in\mathcal L\) is even. For even \(e\), \(H^e\equiv1\bmod4\), so \(H^eg\equiv g\bmod8\). Modulo eight only \(g_1y+g_2y^2\) matters. The sections of \(y^2\) are \(2y^2-y\) and \(2y^2\). Choose \(d=0\) if \(g_1\equiv2\bmod4\) and \(d=1\) otherwise. The first output coefficient is then divisible by four and the second is \(2g_2\equiv4\bmod8\). For \(i\ge3\) the bound \(2^{2i-2}\) above applies. Consequently \(A_d^{(e)}g/2\) lies in \(\mathcal L\) and satisfies \eqref{shape} again. A finite seed calculation supplies the starting state. Use \(N=48\) at \(m\equiv6\bmod16\) and \(N=12\) at \(m\equiv14\bmod16\). Apply the low digits of \(N\) to 1. The resulting \(f\) has zero constant and satisfies \[ f_1\equiv0\pmod{64},\quad f_2\equiv64\pmod{128},\quad f_3\equiv f_4\equiv0\pmod{256},\quad f_5\equiv0\pmod{512}. \] For an explicit verification use the two recurrences for \(J_{\ell,d}\), working modulo 512. For each input monomial \(y^i\) sum \[ \sum_{j=0}^{\min(e,8)}(-1)^{e-j}2^j \binom{e}{j}J_{i+j,d} \] and retain degrees 0 through 5. Higher output degrees vanish modulo 512 by \eqref{weights} and the product bound. Since \(H^2\equiv1\bmod4\), seven further squarings give \(H^{256}\equiv1\bmod512\). It suffices to iterate the two short words for \(m=6,14,\ldots,254\); the supplement gives all 32 output rows. An odd digit supplies the exact zero constant. For \(i\ge6\), \(2i-2\ge5+i-1\). Hence \(f/32\in\mathcal L\) and satisfies \eqref{shape}. Each chosen additional digit gains another factor two. Evaluation at 1 gives an even number after normalization, so after \(t\) digits the positive index has count divisible by \(2^{6+t}\). Positivity rules out a zero count. This proves unboundedness of \(V_m\). \subsection{The automaton and the six conclusions} For a nonzero index remember \(h=0\) or, for \(h>0\), its residue modulo four. Add one initial state for zero. On appending a most-significant-first base-four digit, a 1 or a 3 resets \(h\) to zero, a 2 sets it to 1, and a 0 increases it by 2 for a nonzero prefix. An all-zero prefix remains in the initial state. Give a nonzero state half the table entry rounded down, and the initial state output zero. This proves (2), and the finite output range gives boundedness. Section~\ref{exceptional} proves (1). For (3) the outputs for the valuation of \(n+1\) modulo four are \(1,0,0,1\) in order. The shifted indices \(4n+3,4n+1\) are odd. The four shifted indices \(8n+6,8n+4,8n+2,4n+2\) have valuations \(1,2,1,1\). The indices \(16n+8,2n+1\) have valuations 3 and 0, with equal outputs. Finally \(16(n+1)\) adds four to \(h\). These comparisons and \(n=0,7,1,3\) give all the claimed identities. For (4) the output is 2 exactly at positive even \(h\), and otherwise 1. The three shifted indices \(4n+3,4n+2,4n+1\) have output 1; \(8(n+1)\) and \(2(n+1)\) have positive valuations differing by two; \(16n+12,16n+4,8n+4\) all have valuation 2. This proves the recurrences and the three initial values. For (5) the first row gives \(s+2-(h\bmod2)=s+1+((h+1)\bmod2)\). Taking the integer part after division by two gives the second formula by distinguishing the parities of \(s+1\) and \(h+1\). For (6) the parameters have the same valuation \(s-1\ge2\), so the underlying two-adic valuations coincide for every positive \(n\); the two constant coefficients are both 1. This proves Theorem~\ref{main66} and all six parts.