\section{Proof of the distribution and moment estimates}\label{sec:law} \subsection{Möbius inversion and the three errors} We truncate Möbius inversion \cite[Ch.~2]{Apostol1976} at a common divisibility level and sum the errors over the exact indices. \begin{proof}[Proof of Theorem~\ref{thm:law}] Fix \(X\) with \(\pi_K(X)>0\). If \(I,t\) are positive integers, then \begin{equation} \mathbf1_{\{I=t\}}=\sum_{tv\mid I}\mu(v),\qquad \pi_K(X) P_{X,C}(t)=\sum_{v\ge1}\mu(v)A_{tv}(X). \label{eq:law-invert} \end{equation} The second identity sums the first over \(\p\in\mathcal P_C(X)\). The sum of counts is finite because \(tv\mid I_\p\) implies \(tv\le I_\p\le\Nm\p-1Y}\mu(v)A_{tv}(X) -\pi_K(X)\sum_{tv>Y}\mu(v)b_C(tv). \end{align*} Take absolute values, multiply by \(t^\sigma\), and sum over \(t\). After the triangle inequality the summands are nonnegative, so we may group them by \(n=tv\). As \(t\) ranges over the divisors of \(n\), the resulting inner sum is precisely \(w_\sigma(n)\). This gives the unnormalized inequality \begin{align} \pi_K(X)\sum_{t\ge1}t^\sigma|P_{X,C}(t)-D_C(t)| &\le \underbrace{\sum_{n\le Y}w_\sigma(n)|A_n(X)-\pi_K(X) b_C(n)|}_{\mathcal E_1} +\underbrace{\sum_{n>Y}w_\sigma(n)A_n(X)}_{\mathcal E_2}\notag\\[-1pt] &\hspace{1.5em}+\underbrace{\pi_K(X)\sum_{n>Y}w_\sigma(n)b_C(n)}_{\mathcal E_3}. \label{eq:three} \end{align} \smallskip\noindent\emph{Small divisibility levels.} Fix \(\lambda>0\), to be chosen below. Choose \(C_\lambda\) such that \(\tau(n)\le C_\lambda n^\lambda\) by \eqref{eq:model-divisors}. In \(\mathcal E_1\), every \(n\) is at most \(Y\le X\), so Lemma~\ref{lem:levels} gives the same bound \(O_{K,F,\Gamma,\theta,\lambda}(X^{\theta+\lambda})\) for each absolute difference. By \eqref{eq:law-divisor-weight}, \begin{equation} \mathcal E_1\ll_{K,F,\Gamma,\theta,\lambda} X^{\theta+\lambda}\sum_{n\le Y}n^{\sigma+\lambda} \le X^{\theta+\lambda}Y^{1+\sigma+\lambda} \le X^{\theta+2\lambda}Y^{1+\sigma}. \label{eq:law-small} \end{equation} \smallskip\noindent\emph{Large divisors at the counted primes.} In the empirical term of \eqref{eq:three}, insert \(A_n(X)=\sum_{\p\in\mathcal P_C(X)}\ind_{n\mid I_\p}\). All terms with \(n\ge X\) vanish because \(I_\pY}} w_\sigma(n). \label{eq:law-reorder} \end{equation} For a fixed prime write \(I=I_\p\). For \(I\le Y\) the inner sum is empty. For \(I>Y\) write \(I=\prod_{\ell\mid I}\ell^{\alpha_\ell}\), with \(\ell\) prime. Summing over all choices of exponents for a divisor gives \[ \sum_{n\mid I}\tau(n) =\prod_{\ell\mid I}\sum_{b=0}^{\alpha_\ell}(b+1) =\prod_{\ell\mid I}\frac{(\alpha_\ell+1)(\alpha_\ell+2)}2 \le\prod_{\ell\mid I}(\alpha_\ell+1)^2=\tau(I)^2 . \] Using \(n^\sigma\le I^\sigma\) for \(n\mid I\) and recalling \(IY}} w_\sigma(n) \le I^\sigma\sum_{n\mid I}\tau(n) \le I^\sigma\tau(I)^2 \le C_\lambda^2X^{2\lambda}I^\sigma . \label{eq:law-divisor-tail} \end{equation} We may now include all good prime ideals in the upper bound. Partition the indices above \(Y\) into dyadic bands \(Y_jY}} I_\p^\sigma\notag\\ &\le c_{K,\Gamma} C_\lambda^2 2^\sigma X^{\kappa_r+2\lambda} Y^{\sigma-\kappa_r}\sum_{j\ge0}2^{j(\sigma-\kappa_r)} =\frac{c_{K,\Gamma} C_\lambda^2 2^\sigma}{1-2^{\sigma-\kappa_r}} X^{\kappa_r+2\lambda}Y^{\sigma-\kappa_r}. \label{eq:law-large} \end{align} Here \(2^{\sigma-\kappa_r}<1\). Taking bands of the full index bounds the combined contribution of every omitted divisor of each prime, whatever the absolute residue degree of the prime. \smallskip\noindent\emph{Tail of the algebraic coefficients.} The bound \eqref{eq:degree} gives \(b_C(n)\le c_1/(\varphi(n)n^r)\). By Section~\ref{sec:model}, \(n/\varphi(n)\le\tau(n)\). Applying these inequalities and \eqref{eq:law-divisor-weight} gives \[ w_\sigma(n)b_C(n) \le c_1 n^{-1-r+\sigma}\tau(n)^2 \le c_1 C_\lambda^2 n^{-1-r+\sigma+2\lambda}. \] Choose \(2\lambda0\). Since \(\lfloor Y\rfloor\ge Y/2\) for \(Y\ge1\), \[ \sum_{n>Y}n^{-1-\beta} \le\int_{\lfloor Y\rfloor}^{\infty}z^{-1-\beta}\,dz =\frac{\lfloor Y\rfloor^{-\beta}}{\beta} \le\frac{2^\beta}{\beta}Y^{-\beta}. \] There are at most \([K:\Q]\) prime ideals above each rational prime \(p\le X\), so \(\pi_K(X)\le [K:\Q]X\). With \(Y^{2\lambda}\le X^{2\lambda}\) we obtain \begin{equation} \mathcal E_3\ll_{K,\Gamma,\sigma,\lambda} X Y^{\sigma-r+2\lambda}\le X^{1+2\lambda}Y^{\sigma-r}. \label{eq:law-model-tail} \end{equation} \smallskip\noindent\emph{Choice of the cutoff.} Given \(\eta>0\), take \(\lambda=\min\{\eta/4,(r-\sigma)/4\}\). Then \(2\lambda\le\eta\) and \(\beta>0\). Inserting \eqref{eq:law-small}, \eqref{eq:law-large} and \eqref{eq:law-model-tail} into \eqref{eq:three} gives \begin{align} \pi_K(X)\sum_{t\ge1}t^\sigma|P_{X,C}(t)-D_C(t)| \ll_{K,F,\Gamma,\theta,\sigma,\eta} X^\eta\big( X^\theta Y^{1+\sigma}+X^{\kappa_r} Y^{\sigma-\kappa_r} +X Y^{\sigma-r}\big). \label{eq:balance} \end{align} At \(Y=X^u\), the three exponents inside the parentheses are respectively \begin{equation} e_1=\theta+u+u\sigma,\qquad e_2=\kappa_r(1-u)+u\sigma,\qquad e_3=1-ru+u\sigma. \label{eq:law-powers} \end{equation} The first increases with \(u\) and the second decreases since \(\sigma<\kappa_r\). Equating them cancels the common \(u\sigma\) and gives \[ \theta+u=\kappa_r(1-u),\qquad (1+\kappa_r)u=\kappa_r-\theta,\qquad u=\frac{\kappa_r-\theta}{1+\kappa_r}=\frac{r+1-r\theta}{2r+1}. \] This choice lies in \((0,1)\) since \(0\le\theta<1<\kappa_r\). Direct substitution yields \[ 1-\theta-u=\frac{(2r+1)(1-\theta)-(r+1-r\theta)}{2r+1} =\frac{r-(r+1)\theta}{2r+1}=\dd. \] Consequently \(e_1=e_2=1-\dd+u\sigma\). To compare \(e_3\), write \(1-\dd=\kappa_r(1-u)\), so that \(\dd=\kappa_r u-1/r\). Thus \begin{equation} e_1-e_3=ru-\dd=(r-\kappa_r)u+1/r>0, \label{eq:law-third-gap} \end{equation} since \(r-\kappa_r=r-1-1/r\ge1/2\) for every allowed \(r\ge2\). At this crossing \(e_3\) is strictly smaller. To its left \(e_2\) is larger than its value at the crossing, and to its right \(e_1\) is larger. This explains why balancing the first two terms also minimizes the largest of all three exponents. The right side of \eqref{eq:balance} is therefore \(O_{K,F,\Gamma,\theta,\sigma,\eta}(X^{1-\dd+u\sigma+\eta})\). For normalization apply Lemma~\ref{lem:levels} at level one with the full filter, for which the excluded set is fixed and finite. Choosing \(0<\lambda<1-\theta\) in that lemma gives \(\pi_K(X)\sim\Li(X)\sim X/\log X\). Divide the raw bound by \(\pi_K(X)\gg_K X/\log X\) for sufficiently large \(X\), and take \(\eta=\eps/2\). Then \(\log X\ll_\eps X^{\eps/2}\) proves \eqref{eq:law}. All estimates are independent of \(C\). Taking \(\eps=(\dd-u\sigma)/2>0\), for example, gives the saving \[ c=\frac{\dd-u\sigma}{2} =\frac{r-(r+1)\theta-(r+1-r\theta)\sigma}{2(2r+1)}. \qedhere \] \end{proof} For the test-function interpretation, put \(a_t=P_{X,C}(t)-D_C(t)\). The finite empirical support and \eqref{eq:abs} ensure that \(\sum_t t^\sigma|a_t|<\infty\). For test functions \(\Phi:\N\to\C\), the triangle inequality gives the upper bound in \begin{equation} \sup_{\Phi:\,|\Phi(t)|\le t^\sigma\ \forall t} \left|\sum_{t\ge1} \Phi(t)a_t\right| =\sum_{t\ge1}t^\sigma|a_t|. \label{eq:law-dual} \end{equation} The real-valued function \(\Phi(t)=t^\sigma\operatorname{sgn}(a_t)\) attains equality even if the supremum permits complex values. It can be chosen afresh for every \(X,C\). In particular, at \(\sigma=0\) every indicator of a set \(S_X\subseteq\N\) is allowed. The absolute discrepancy on \(S_X\) is bounded by \eqref{eq:law} with the same constant for every choice of \(S_X\). \subsection{The moment constant and an example} \begin{proof}[Proof of Corollary~\ref{cor:mom}] For \(s>0\), expanding the Euler factors and writing \(k=d/e\) in the divisor sum gives \begin{align} J_s(n) &=n^s\prod_{\ell\mid n}(1-\ell^{-s}) =\sum_{e\mid n}\mu(e)(n/e)^s,\notag\\ \sum_{d\mid n}J_s(d) &=\sum_{d\mid n}\sum_{e\mid d}\mu(e)(d/e)^s =\sum_{k\mid n}k^s\sum_{e\mid n/k}\mu(e)=n^s. \label{eq:law-jordan} \end{align} Here and below \(\ell\) in a product denotes a prime. For every \(00\) for nonempty \(C\), while the empty filter gives \(M_{s,C}=S_{s,C}(X)=0\). Now assume the hypotheses of Theorem~\ref{thm:law} and take \(0\theta\), it is absorbed in \eqref{eq:mom}. For nonempty \(C\), \(M_{s,C}\ge1/|G_F|\) and \(\Li(X)\asymp X/\log X\). Hence the relative error is \(O_{K,F,\Gamma,\theta,s,\eps}(X^{-\dd+us+\eps}\log X)\). Choose \(0<\eps<\dd-us\), possible precisely for \(s<\sigma_*\), to conclude the asserted relative asymptotic. Substituting \(\theta=1/2\) gives \(u=(r+2)/(2(2r+1))\), \(\dd=(r-1)/(2(2r+1))\), and hence \(\sigma_*=(r-1)/(r+2)\). \end{proof} Take \(K=F=\Q\), \(C=\{1\}\), and \(\Gamma=\langle2,3\rangle\). The valuations at \(2\) and \(3\) give rank two and independent square classes, so \(K_2=\Q(\sqrt2,\sqrt3)\) has degree four. Since \(F=K\), all the level coefficients are \(b_C(n)=1/k_n\), in particular \(b_C(2)=1/4\). The \(n=1,2\) terms give \[ M_{s,C}\ge1+\frac{2^s-1}{4}>1\qquad(0