\documentclass[11pt]{amsart} \usepackage[margin=1.1in]{geometry} \usepackage{amsmath,amssymb,amsthm} \usepackage{hyperref} \newtheorem{theorem}{Theorem} \newtheorem{proposition}[theorem]{Proposition} \newtheorem{lemma}[theorem]{Lemma} \newtheorem{corollary}[theorem]{Corollary} \theoremstyle{remark} \newtheorem{remark}[theorem]{Remark} \newcommand{\F}{\mathbb{F}} \newcommand{\Tr}{\operatorname{Tr}} \newcommand{\Nm}{\operatorname{Nm}} \title{Second moments of pattern counts in dual Melas codewords} \author{David Niedbala Giraudin} \address{Meaux, France} \thanks{ORCID 0009-0009-1526-1178} \date{9 November 2026} \begin{document} \begin{abstract} Let $\alpha$ be a primitive element of $\F_{2^k}$ and, for $c\in\F_{2^k}^*$, let $S_c=(\Tr(\alpha^i+c\alpha^{-i}))_{0\le i\le 2^k-2}$ be the corresponding codeword of the dual Melas code. Let $X_{k,c}(w)$ be the number of occurrences of a uniformly random pattern $w\in\F_2^k$ in $S_c$. Sac Himelfarb and Schwartz conjectured that $X_{k,c_k}$ converges to the Poisson law $\mathcal P(1)$ for every choice of $c_k\in\F_{2^k}^*$; they proved that the second factorial moment satisfies $\limsup M_2\le 2$, and $M_2\to1$ for almost every sequence $(c_k)$. We prove that $|M_2^{(k,c)}-1|\le 2^{-(1/22+o(1))k}$ uniformly in $c\in\F_{2^k}^*$ and in the primitive element $\alpha$. Thus the second factorial moment converges to $1$ for every sequence $(c_k)$. The proof expresses $M_2$ through a norm form of the quadratic extension $\F_2(x)/\F_2(x+x^{-1})$, which turns it into a bilinear Kloosterman sum of full length, and bounds the latter in characteristic two. We also show that the counts $N_w(S_c)$, as functions of $(w,c)$, are the fibre sizes of a family of quadratic maps, and deduce that for almost every sequence of patterns $w_k$ the first two factorial moments of $c\mapsto N_{w_k}(S_c)$ converge to $1$, as they would under the Poisson law conjectured by Sac Himelfarb and Schwartz for fixed patterns. \end{abstract} \maketitle \section{Statement} Let $k\ge3$, $F=\F_{2^k}$, $n=2^k-1$, $\chi(z)=(-1)^{\Tr(z)}$ where $\Tr=\Tr_{F/\F_2}$, and let $\alpha\in F$ be primitive. For $c\in F^*$ put $S_c(i)=\Tr(\alpha^i+c\alpha^{-i})$, $i\in\mathbb Z/n$. As in \cite{SHS}, for $w\in\F_2^k$ let $N_w$ be the number of $i\in\mathbb Z/n$ with $(S_c(i),\dots,S_c(i+k-1))=w$ (indices mod $n$), let $X_{k,c}(w)=N_w$ on $\F_2^k$ with the uniform measure, and \[ M_2^{(k,c)}=\mathbb E\big[X_{k,c}(X_{k,c}-1)\big]=2^{-k}\sum_{w\in\F_2^k}N_w(N_w-1). \] For $N\ge2$ let $\tau_N$ denote the maximal number of monic divisors of a nonzero polynomial of degree $\le N$ in $\F_2[s]$. \begin{theorem}\label{thm:main} For all $k\ge3$, all primitive $\alpha\in\F_{2^k}$ and all $c\in\F_{2^k}^*$, \[ \big|M_2^{(k,c)}-1\big|\;\le\;2^{-k}\Big(1+k^3\,C_k\,2^{21k/22}\Big),\qquad C_k=8+2\,(12\,\tau_{3k})^{1/4}, \] and $\tau_N\le (N+1)^{2\sqrt N}\,2^{2N/\log_2 N}=2^{o(N)}$. In particular $\max_{c\in F^*}|M_2^{(k,c)}-1|\le 2^{-(1/22+o(1))k}$, and $M_2^{(k,c_k)}\to1$ for every sequence $c_k\in\F_{2^k}^*$. \end{theorem} Conjecture~35 of \cite{SHS} asserts convergence in distribution to $\mathcal P(1)$, and \cite{SHS} proposes to prove it through the convergence of all factorial moments; Theorem~\ref{thm:main} establishes the second of these steps uniformly in $c$. Compare \cite[Theorem~37]{SHS}, which gives $\limsup_k M_2^{(k,c_k)}\le2$ for every sequence and $M_2^{(k,c_k)}\to1$ for almost every sequence. Since $M_1^{(k,c)}=1-2^{-k}$, Theorem~\ref{thm:main} also gives $\operatorname{Var}(X_{k,c})\to1$ uniformly in $c$. The exponent $1/22$ is not optimised. Throughout, $P_\ell\subset\F_2[x]$ (or $\F_2[s]$) denotes the set of polynomials of degree $<\ell$ (including $0$). \section{Zero windows and the norm $h(\alpha)h(\alpha^{-1})$} Let $m_\alpha$, $m_{\alpha^{-1}}$ be the minimal polynomials of $\alpha,\alpha^{-1}$ over $\F_2$. They are distinct: otherwise $\alpha^{-1}=\alpha^{2^j}$ with $0\le j(1/2-\eta)k$ and $d+e\le k-1$, so $\max(d,e)<(1/2+\eta)k$, and (iii) gives \[ \frac{|S_{d,e}|^4}{2^{4(d+e)}}\le12\tau_{3k}\max\big(2^{k-d-2e},\,2^{(k+3)/2-d-e/2}\big)\le 12\tau_{3k}\,2^{3/2}\,2^{(-1/4+3\eta/2)k}, \] because $k-d-2e<(-1/2+3\eta)k$ and $(k+3)/2-d-e/2<(-1/4+3\eta/2)k+3/2$. As $-\frac1{16}+\frac{3\eta}{8}=-\frac1{22}$ and $d+e\varepsilon\Big\}\;\le\;\frac{120\,k^3\,2^{-k/2}}{(\varepsilon-2^{2-k})^2}. \] Consequently, for almost every sequence $(w_k)\in\prod_k\F_2^k$, $\mathbb E[X_{w_k}]\to1$ and $\mathbb E[X_{w_k}(X_{w_k}-1)]\to1$. \end{theorem} \begin{proof} Write $\delta=\delta_w$ and $\lambda=\kappa c$, which is uniform on $F^*$. (i) $\sum_{\lambda\ne0}\#\Phi_\delta^{-1}(\lambda)=2^k-\#\Phi_\delta^{-1}(0)$ and $\Phi_\delta^{-1}(0)=\{0,\psi^{-1}(\delta)\}$, of size $2$ for $\delta\ne0$. (ii) Let $S(\delta)=\#\{(y,y'):y\ne y',\ \Phi_\delta(y)=\Phi_\delta(y')\}$; then $n\,\mathbb E[X_w(X_w-1)]=S(\delta)-2$ for $w\ne0$. For $a\ne0$, $\Phi_\delta(y+a)+\Phi_\delta(y)=\ell_a(y)+a\psi(a)+\delta a$ with $\ell_a(y)=y\psi(a)+a\psi(y)$, which is $\F_2$-linear in $y$. Let $d_a=\dim\ker\ell_a$ and $C_a=\{\delta:\delta a\in a\psi(a)+\operatorname{Im}\ell_a\}$, an affine subspace of codimension $d_a$ with direction $D_a=a^{-1}\operatorname{Im}\ell_a$. Then $S(\delta)=\sum_{a\ne0}2^{d_a}\mathbf 1_{C_a}(\delta)$, whose mean over $\delta\in F$ is $m=\sum_{a\ne0}1=n$. Put $\rho(a)=\psi(a)/a$, $E_\rho=\{y:\psi(y)=\rho y\}$ and $E^*_\rho=\{\theta:\psi^*(\theta)=\rho\theta\}$, where $\psi^*$ is the adjoint of $\psi$ for $(u,v)\mapsto\Tr(uv)$. Then $\ker\ell_a=E_{\rho(a)}$. The adjoint of $\ell_a$ is $z\mapsto z\psi(a)+\psi^*(za)$, so $\theta\in D_a^\perp$ iff $\ell_a^*(\theta/a)=0$ iff $\psi^*(\theta)=\rho(a)\theta$: $D_a^\perp=E^*_{\rho(a)}$. If $\rho(a)\ne\rho(b)$ then $D_a^\perp\cap D_b^\perp=0$, so $D_a+D_b=F$ and $|C_a\cap C_b|=2^{k-d_a-d_b}$. Therefore \[ \sum_{\delta\in F}(S(\delta)-m)^2=\sum_{a,b\ne0}2^{d_a+d_b}\big(|C_a\cap C_b|-2^{k-d_a-d_b}\big)\le\sum_{\rho(a)=\rho(b)}2^{2d_a}2^{k-d_a} =\sum_v(2^{d_v}-1)^2\,2^{k+d_v}, \] where $v$ runs over the values of $\rho$ and $\{a:\rho(a)=v\}=E_v\setminus\{0\}$ has $2^{d_v}-1$ elements. Here $\sum_v(2^{d_v}-1)^2=\Sigma_0$ and $2^{d_v}\le2(2^{d_v}-1)\le2\Sigma_0^{1/2}$, so by Lemma~\ref{lem:pairs} the sum is $\le2^{k+1}\Sigma_0^{3/2}\le 30\,k^32^{5k/2}$. Since $|\mathbb E[X_w(X_w-1)]-1|\le|S(\delta_w)-m|/n+2/n$ for every $w$, $2/n\le2^{2-k}$ and $n^2\ge2^{2k-2}$, Chebyshev's inequality gives (ii). The bound is summable in $k$, and so is $\Pr(w_k=0)=2^{-k}$; the last statement follows from the Borel--Cantelli lemma (applied with $\varepsilon=1/j$, $j=1,2,\dots$) and (i). \end{proof} \section{Numerical verification} The ancillary script \texttt{VERIF\_MELAS\_M2.py} (pure Python) checks: \begin{itemize} \item Proposition~\ref{prop:M2} against direct pattern counting, for every $c\in F^*$ and $4\le k\le10$ (a single constant $\kappa$ for all $c$); \item Proposition~\ref{prop:norm}, for every $P$ with $\deg P