\documentclass[11pt,letterpaper]{article} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage[margin=1in]{geometry} \usepackage{amsmath,amssymb,amsthm} \usepackage{microtype} \usepackage{xcolor} \definecolor{linkblue}{RGB}{0,56,164} \usepackage[colorlinks=true,allcolors=linkblue]{hyperref} \hypersetup{pdftitle={Mutually Orthogonal Latin Squares Under GRH}, pdfauthor={Samuel Korsky}} \linespread{1.08} \setlength{\parindent}{0pt} \setlength{\parskip}{.75\baselineskip} \setlength{\emergencystretch}{1.5em} \newtheorem{theorem}{Theorem}[section] \newtheorem{proposition}[theorem]{Proposition} \newtheorem{lemma}[theorem]{Lemma} \newtheorem{corollary}[theorem]{Corollary} \newcommand{\F}{\mathbb F} \newcommand{\TD}{\mathrm{TD}} \newcommand{\Tr}{\operatorname{Tr}} \newcommand{\A}{\mathcal A} \newcommand{\T}{\mathcal T} \newcommand{\ind}{\mathbf 1} \newcommand{\eps}{\varepsilon} \newcommand{\ph}{\varphi} \newcommand{\E}{\mathbb E} \title{Mutually Orthogonal Latin Squares Under GRH} \author{Samuel Korsky} \date{November 28, 2026} \begin{document} \begingroup \setlength{\parskip}{0pt} \maketitle \endgroup \begin{abstract} \noindent Let $N(n)$ be the maximum number of mutually orthogonal Latin squares of order $n$. Assuming the generalized Riemann hypothesis for Dirichlet $L$-functions, we prove $N(n)\gg n^{1/5}/(\log n)^4$ for every sufficiently large $n$. \end{abstract} \section{Introduction} A Latin square of order $n$ is an $n\times n$ array on $n$ symbols in which every symbol occurs once in each row and column. Two such squares are orthogonal if superimposing them gives each of the $n^2$ ordered pairs of symbols once. Write $N(n)$ for the largest size of a pairwise orthogonal family. A finite field gives $N(q)=q-1$ for every prime power $q$. If $n=q_1\cdots q_m$ is a product of powers of distinct primes, the direct product construction gives $N(n)\ge\min_i(q_i-1)$ \cite{macneish}. For $n\equiv2\pmod4$ this bound gives only one square. Bose, Shrikhande and Parker proved $N(n)\ge2$ for all $n\ge7$~\cite{bsp}. Chowla, Erd\H{o}s and Straus proved the first polynomial lower bound valid for every sufficiently large order, with exponent $1/91$ \cite{ces}. Rogers improved this exponent \cite{rogers}, Wilson obtained $1/17$ \cite{wilson}, and Beth obtained $1/14.8$ \cite{beth}. Lu proved the unconditional bound $N(n)\gg n^{1/14.3}$ \cite{lu,bds}. Erd\H{o}s suggested that $N(n)\gg\sqrt n$ might hold \cite{erdos}. Here we assume the generalized Riemann hypothesis for Dirichlet $L$-functions, abbreviated GRH. \begin{theorem}\label{thm:main} Assume GRH. For every sufficiently large integer $n$, \[ N(n)\gg \frac{n^{1/5}}{(\log n)^4}. \] \end{theorem} \begin{samepage} \begin{theorem}\label{thm:almost} Assume GRH and fix $D>0$. All but $O_D(X/(\log X)^D)$ odd integers $n\in[X,2X]$ satisfy \[ N(n)\gg_D \frac{X^{1/4}}{(\log X)^{3+D/2}}. \] For every fixed $\eps>0$, the bound $N(n)\gg_\eps X^{1/4-\eps}$ holds outside a set of $O_\eps(X^{1-\delta_\eps})$ odd integers in $[X,2X]$, for some $\delta_\eps>0$. If $0<\eps<1/12$, the number of exceptions is $O_\eps(X^{1-2\eps}(\log X)^6)$. \end{theorem} \end{samepage} The construction has two stages. First we construct designs with a hole whose size can vary through consecutive multiples of a power of two $h$. At order $A$ these holes allow us to construct $k$ squares of order $At+u$ whenever $t$ is a suitable prime, $u$ is small enough, and $N(A+1),N(u)\ge k$. To bound the exceptional set for odd targets, we count representations in which $A+1$ and $u$ are both prime powers. We need the exceptional set in each odd class modulo $h$, since the uniform bound uses this estimate in the particular class $A+1\equiv1\pmod h$. For an even target the remainder $u$ is even. We construct it separately from three primes before applying the same result on holes. Throughout the proof $k$ is a sufficiently large integer. We write $r=k+2$, let $h$ be the least power of two at least $r$, and put $L=\log(2k)$. In particular $h\asymp k$. All logarithms are natural. Implied constants are absolute unless a dependence is indicated. \section{Transversal designs with holes}\label{sec:design} A transversal design $\TD(r,v)$ is a set of words of length $r$ on a $v$-element alphabet such that projection onto any two coordinates is a bijection onto all ordered pairs. Taking the first two coordinates as row and column and the remaining $k$ as entries gives $k$ mutually orthogonal Latin squares. Conversely, reading off those coordinates from $k$ squares gives the design. Over $\F_q$, the words $(x,y,(x+\alpha y)_{\alpha\in\F_q^\times})$ give $q-1$ squares. This attains the upper bound $v-1$, since after normalizing the first row of each square, the entries in a fixed cell of the second row must be distinct and must avoid the first-row entry above them. Let $H_1,\ldots,H_m$ be disjoint subsets of an alphabet. A design with these \emph{holes} covers every ordered pair in each two coordinates exactly once, except that the pairs in $\bigcup_i H_i\times H_i$ are omitted. Filling $H_i$ means adjoining the words of a complete design on $H_i$. We say a weight $w$ is \emph{available at $A$} if there is a design of order $A+w$ with a hole of size $w$. Thus weight zero is available if $N(A)\ge k$. If $N(A+1)\ge k$, deleting one word and relabeling its entries as the same symbol in the different coordinates gives weight one at $A$. We use the weighted construction of Brouwer and van Rees \cite[Theorem~1.1]{bvr}. Take a transversal design of order $t$ with $r$ ordinary coordinates and some extra coordinates. Give each ordinary symbol a set of $A$ copies in its coordinate. Assign to each symbol of each extra coordinate a disjoint set of new symbols, shared by all $r$ output coordinates. For each word of the design on $t$, put on its ordinary copies and new symbols a design with one hole for each nonempty new set in that word. The union of these local designs leaves a hole for each extra coordinate, consisting of all the new symbols assigned to it. Indeed, two ordinary symbols in different coordinates determine a unique master word, as do an ordinary and an extra symbol, or symbols from different extra coordinates. The local design covers each corresponding pair of copies. Two new symbols from the same extra coordinate give precisely the pairs inside its hole. In particular, if $t\ge r$ is prime, a field design supplies one extra coordinate. Assign its $t$ symbols available weights of positive sum $u$ and fill the resulting hole of size $u$. This gives \begin{equation}\label{eq:weighted} N(At+u)\ge k\qquad\text{whenever }N(u)\ge k . \end{equation} \begin{lemma}\label{lem:local} Put $a=h(2h-1)$. For $i=0,1,2$, there is a design on $a+ih$ symbols with $i$ disjoint holes of size $h$. \end{lemma} \begin{proof} In $\F_{2h}^2$ put $S_\delta=\{(x,y):\Tr(xy)=\delta\}$, where $\Tr$ is the absolute trace to $\F_2$. For $x\ne0$ each trace value occurs $h$ times. When $x=0$ the trace vanishes identically. Hence $|S_1|=a$ and $|S_0|=a+2h$. Every nonempty line section has $h$ or $2h$ points. For a nonvertical line $y=cx+e$ this follows from $\Tr(cx^2+ex)=\Tr((c^h+e)x)$, using invariance of the trace under squaring. The vertical sections have the sizes just counted. On a section of size $q\in\{h,2h\}$, identify its points with $\F_q$ and use the words \[ \bigl(x,y,((1-\alpha)x+\alpha y)_{\alpha\in T}\bigr), \qquad T\subset\F_q\setminus\{0,1\},\quad |T|=k . \] When $x=y$ these words are constant. When $x\ne y$ their coordinates are all distinct. For each $S_\delta$, take the union over all line sections, including each constant word just once. Two distinct points determine a unique line, so every unequal ordered pair is covered once. The constant words cover the equal pairs. This gives a full design on $S_1$. In $S_0$, two distinct nonzero vertical sections are disjoint $h$-point subdesigns. Deleting their words leaves the two required holes. For one hole, take the coordinatewise product of the two field designs of orders $h$ and $2h$. Holding the second component at a constant word gives a subdesign of order $h$. Its deletion leaves one hole in order $2h^2=a+h$. \end{proof} \begin{lemma}\label{lem:parabola} Let $p>2r+1$ be prime and $0\le s,j\le(p-1)/2$ be integers. Then $jh$ is available at $A=ap+sh$. \end{lemma} \begin{proof} Use the affine words $(ux+v)_{x\in\F_p}$, with $u,v\in\F_p$. Choose $r$ nonzero nonsquares as ordinary coordinates, each with weight $a$. In $s$ distinct nonzero square coordinates $x$, give weight $h$ to the symbol $x^2$. In coordinate zero give weight $h$ to $j$ nonzero ordinates outside the set of negatives of nonzero squares. Give all other extra symbols weight zero. A line meets the parabola in at most two points. If it passes through $(x,x^2)$ and $(x',x'^2)$ with $x\ne x'$, its intercept is $-xx'$. For marked abscissas this is the negative of a nonzero square. Consequently each affine word contains at most two positive extra weights. Lemma~\ref{lem:local} supplies its local design. Fill the $s$ holes of size $h$ using the field design and leave the hole at coordinate zero. The resulting order is $ap+sh+jh$. \end{proof} Let $\A$ be the set of positive multiples $A$ of $h$ for which every weight $jh$, $0\le j\le\lfloor A/(16h^2)\rfloor$, is available. In particular $N(A)\ge k$ for $A\in\A$. \begin{lemma}\label{lem:transfer} Suppose $A\in\A$, $A\ge32h^2$, $N(A+1)\ge k$, and $t\ge4h$ is prime. If $1\le u\le At/(100h)$ and $N(u)\ge k$, then $N(At+u)\ge k$. \end{lemma} \begin{proof} The largest listed weight $B=h\lfloor A/(16h^2)\rfloor$ is at least $A/(32h)$. Use $\lfloor u/B\rfloor$ copies of $B$, then the largest multiple of $h$ below or equal to the remainder, and finally fewer than $h$ ones. Weight one is available by deletion from order $A+1$. At most $32t/100+1+h2r+1$ for large $k$. Since $v<(d+1/4)p$, we also have $\lfloor A/(16h^2)\rfloor\le(p-1)/2$. Lemma~\ref{lem:parabola} now supplies all the required weights. The interval for $p$ has length $\asymp P/h$. The $q=1$ estimate for $\theta$ in \eqref{eq:long} gives a prime in each such interval when its length exceeds a sufficiently large multiple of $\sqrt P L^2$. This holds for $Y\ge C_0h^4L^4$. For the first assertion, take $J=cP/h$ with a sufficiently small absolute $c>0$. In an interval of length $J$ at scale $P$, powers of exponent $\nu\ge2$ have total weight $O((J/\sqrt P+1)L^2)$. To see this, count possible integer bases for each $\nu$ in an interval of length $O(JP^{1/\nu-1})$, and sum over $\nu\ll L$. Our lower bound for $Y$ makes this weight $o(J)$. By \eqref{eq:short} with $q=1$, the set of right endpoints $z\asymp P$ for which $(z-J,z]$ contains no prime has measure $O(PL^2/J)$. If $v$ fails the prime condition, every $z\in(v/d-1/d,v/d]$ is such an endpoint, since $(z-J,z]$ lies inside the interval for $p$. These endpoint intervals are disjoint as $v$ varies. The number of failures is therefore $O(dPL^2/J)=O(h^2L^2)$. \end{proof} \begin{corollary}\label{cor:multiples} Assume RH. For each sufficiently large $X$ one can choose a power of two $h\asymp X^{1/4}/\log X$ such that $N(n)\ge h-2$ for every multiple of $h$ in $[X,2X]$. If $0<\eps<1/12$ and $h\asymp X^{1/3-\eps}$ is a power of two, then all but $O(h^2(\log X)^2)$ multiples of $h$ in that interval satisfy $N(n)\ge h-2$. \end{corollary} \begin{proof} Put $k=h-2$ and $Y=X$. In the first assertion choose $h$ as the largest power of two at most $cX^{1/4}/\log X$, for $c$ sufficiently small. Then $C_0h^4L^4\le X$. In the second assertion $C_0h^3L^4\le X$. Both choices give $X\le k^7$ for large $X$, so the two conclusions follow from Lemma~\ref{lem:bases} and the availability of weight zero. In the second case the exceptional proportion among multiples of $h$ is $O(X^{-3\eps}(\log X)^2)$. \end{proof} \section{Prime powers in an odd residue class}\label{sec:fourier} Write $e(x)=\exp(2\pi i x)$, let $\mu$ be the M\"obius function, and let $c_s(m)=\sum_{a\bmod s}^{*}e(am/s)$ be the Ramanujan sum. For a finitely supported sequence $f$ on $\mathbb Z$, use $\widehat f(\alpha)=\sum_{j\in\mathbb Z}f(j)e(\alpha j)$ on $\mathbb R/\mathbb Z$. Fix a nonnegative smooth function $\Phi$ supported in $(1/2,4)$ and equal to one on $[1,3]$. \begin{lemma}\label{lem:fourier} Assume GRH. Let $b$ be odd with $1\le bR$ the density contribution is $O(W\ell/R)$, using $q/\ph(q)\ll\log(2q)$. To compare with $\widehat{V_b}$, expand the Ramanujan sums into their reduced frequencies $-dh/s\pmod1$. When $q\le R$ is odd, the frequency $a/q$ occurs at $s=q$, $d\equiv-a\bar h\pmod q$. Poisson summation at this frequency gives exactly the density integral above as its zero mode. There is no matching frequency for even $q$ or for $q>R$. Every other reduced frequency of denominator $s\le R$ is at distance $\gg 1/(R\sqrt W)$ from $\alpha$, by the separation $1/(qs)$ and the bound on $\beta$. Repeated integration by parts in the Poisson integrals bounds their total, including the nonzero modes at a matching frequency, by $O_{\Phi,m}(WR^2(1+\sqrt W/R)^{-m})$ for each $m\ge2$. Since $R\le W^{1/4}$, this is absorbed by $O_\Phi(W\ell/R)$. Finally $\sqrt U\,W^{1/4}=W(h^3/U)^{1/4}$. \end{proof} \section{Odd orders in a fixed residue class}\label{sec:odd} The lower bound for the number of representations will use the following positivity property of Ramanujan sums at odd moduli. \begin{lemma}\label{lem:positive} There is an absolute $c_*>0$ such that, for every integer $d$ and every $R\ge1$, \[ B_R(d):=\sum_{\substack{s\le R\\s\ {\rm odd}}} \frac{\mu(s)^2c_s(d)}{\ph(s)^2}\ge c_* . \] \end{lemma} \begin{proof} For a prime $p$, $c_p(d)=p-1$ if $p\mid d$, and $c_p(d)=-1$ otherwise. By multiplicativity, writing a squarefree $s$ as $av$ with $a=(s,d)$ gives the summand $\mu(v)/(\ph(a)\ph(v)^2)$. For every odd squarefree $a\mid d$ with $a\le R$, the sum over odd squarefree $v\le R/a$ coprime to $d$ is, after the factor $1/\ph(a)$ is taken out, at least \[ 1-\sum_{\substack{v>1\\v\ {\rm odd}}}\frac{\mu(v)^2}{\ph(v)^2} =2-\prod_{p>2}\left(1+\frac{1}{(p-1)^2}\right) \ge 2-\exp(\pi^2/24)>0 . \] Here the numbers $p-1$ for odd primes are distinct positive even integers. Retaining the term $a=1$ gives the assertion. \end{proof} \begin{proposition}\label{prop:odd} Assume GRH. If $k^4\le X\le k^6$, then for every odd class $b\bmod h$, \[ \#\{n\in[X,2X]: n\equiv b\pmod h,\ N(n)C_1L^{12}$. Then $2\le R\le W^{1/4}$ and $R<8h$ by $X\le k^6$. For $y\in\mathcal Y=[X-3U,2X]$, put $I_y=(y+2U,y+3U]$ and \[ J_t=\left(\frac{y}{ht},\frac{y+U}{ht}\right],\qquad H_t=|J_t|=\frac{W}{t}\asymp hS \quad (t\in\T). \] If $n\in I_y$ and $v\in J_t$, then $u=n-htv\in[U,3U]$. Here $A=hv\asymp X/h$, $At\asymp X$, and the choice of $U$ ensures $u\le At/(100h)$. Both $A+1$ and $u$ exceed $k+1$. Thus for $A\in\A$, a positive value of $\Lambda(hv+1)\Lambda(n-htv)$ gives $N(n)\ge k$ by Lemma~\ref{lem:transfer} and the field construction. Fix the odd representative $1\le bR$, expanding the Ramanujan sum gives \[ \frac{1}{\ph(s)}\sum_{x\bmod s}^{*}c_s(n+t-tx) =\frac{\mu(s)c_s(n+t)}{\ph(s)} . \] Indeed the sum over $x$ in each reduced frequency equals $c_s(1)=\mu(s)$. Consequently the main term of $(F*V_b)(j)$ is $2\sum_{t\in\T}2H_t B_R(n+t)$, which is at least $2c_* K$ by Lemma~\ref{lem:positive}. The error is bounded uniformly in $j$ by \[ E(y)=2\sum_{t\in\T}\sum_{\substack{s\le R\\s\ {\rm odd}}} \sqrt{s/\ph(s)}\,\|Z_{t,s}\|_2 . \] Indeed $(ht,s)=1$ and orthogonality gives $\sum_{c\bmod s}|c_s(n-htc)|^2=s\ph(s)$. We have $\sum_{s\le R}\sqrt{s/\ph(s)}\ll R$, since $s/\ph(s)=\sum_{d\mid s}\mu(d)^2/\ph(d)$ and $\sum_d\mu(d)^2/(d\ph(d))<\infty$. The $L^2$ triangle inequality, \eqref{eq:local-ms}, and $H_t\asymp hS$ now yield \begin{equation}\label{eq:main-error} (\E_y E(y)^2)^{1/2}\ll KRL/\sqrt S . \end{equation} Taking $s=1$ in the same calculation gives $\left|\sum_l F(l)-K\right|\le E(y)$. Let $D(y)$ be the contribution to $\sum_l F(l)$ from $hv\notin\A$. The possible $hv$ lie in a bounded number of dyadic intervals at scale $X/h$. Our lower bound on $S$ puts them in the range of Lemma~\ref{lem:bases}, so $O(h^2L^2)$ such values are outside $\A$. For each $t$, a fixed $v$ contributes $O(L)$ on a $y$-interval of length at most $U$. It follows that \[ \E_y D(y)\ll \frac{|\T|h^2L^3U}{X}\ll \frac{KL^3}{S}. \] Fix $C$ such that $\Lambda(u)\le CL$ for $u\in[U,3U]$. Call $y$ exceptional if $E(y)>c_*K/4$ or $CLD(y)>c_*K/4$. By \eqref{eq:main-error} and the last estimate, the exceptional proportion of $\mathcal Y$ is \begin{equation}\label{eq:bad-y} O\!\left(R^2L^2/S+L^4/S\right). \end{equation} For every remaining $y$, $F(l)\ll L$ since $l\ll k^6$ has only $O(1)$ prime divisors $t\ge8h$, each determining $v=l/t$. Hence $\sum_l F(l)^2\ll LK\ll W$. Parseval's identity and Lemma~\ref{lem:fourier} give \[ \sum_{j\in\mathbb Z}|(F*(P_b-V_b))(j)|^2 \le \|\widehat{P_b}-\widehat{V_b}\|_\infty^2\sum_l F(l)^2 \ll W^3L^4/\sqrt S . \] The number of $j$ for which the absolute error exceeds $c_*K/2$ is $O(WL^6/\sqrt S)$. For each remaining $n=b+hj\in I_y$, subtracting the contribution at most $CLD(y)$ from inadmissible $A$ leaves a positive weighted count. Such an $n$ has $N(n)\ge k$. Every $n\in[X,2X]$ belongs to $I_y$ for a set of $y$'s of length $U$. Integrate the count of failures and divide by $U$. For exceptional $y$ use the bound $O(W)$ for the number of integers in the class inside $I_y$. With \eqref{eq:bad-y} and $R=S^{1/4}$, this gives \[ \ll \frac XU\,\frac{WL^6}{\sqrt S} =\frac Xh\,\frac{L^6}{\sqrt S}\ll h\sqrt X\,L^6 , \] as claimed. \end{proof} \begin{proof}[Proof of Theorem~\ref{thm:almost}] Summing Proposition~\ref{prop:odd} over the $h/2$ odd classes gives $O(h^2\sqrt X\,L^6)$ exceptions. Take $k=\lfloor X^{1/4}/(\log X)^{3+D/2}\rfloor$. Then $k^4\le X\le k^6$ for large $X$, and the exceptional count is $O_D(X/(\log X)^D)$. With $k=\lfloor X^{1/4-\eps}\rfloor$ the same range holds whenever $0<\eps<1/12$, and the exceptional count is $O_\eps(X^{1-2\eps}(\log X)^6)$. For every fixed $\eps>0$, using a smaller positive $\eps$ if necessary, this gives the bound $N(n)\gg_\eps X^{1/4-\eps}$ outside a set of size $O_\eps(X^{1-\delta_\eps})$ for some $\delta_\eps>0$. \end{proof} \section{A construction for every order}\label{sec:uniform} To apply Lemma~\ref{lem:transfer} at an arbitrary order $n$, we seek many pairs $(t,m)$ such that $m\equiv n\pmod{ht}$ and $N(m)\ge k$. Then $A=(n-m)/t$ is a multiple of $h$, and we can test $A+1$ in the single class $1\bmod h$. For odd $n$ we may take $m$ prime. For even $n$ we construct the remainders $m$ as follows. \begin{lemma}\label{lem:even} Assume GRH. Fix $B\ge1$. Let $n$ be even with $Bk^5L^{20}\le n\le 2Bk^5L^{20}$, put $M=n/(10^4h)$, and let $\T$ be the primes in $[8h,16h]$. For all sufficiently large $k$ there are $\gg M/(hL^4)$ pairs $(t,m)$ with \[ t\in\T,\qquad M\le m\le5M,\qquad m\equiv n\pmod{ht},\qquad N(m)\ge k. \] The implied constant is absolute. The threshold for $k$ may depend on $B$. \end{lemma} \begin{proof} Put $G=kL^6$ and $P=M/G\asymp Bk^3L^{14}$. First find many primes $g\in[G,2G]$ for which $g+\Delta$ is also prime, with the same $\Delta\equiv n\pmod h$ for all $g$. To do so, apply \eqref{eq:long} for $\theta$ at both ends of $[G,2G]$ and of $[G/4,G/2]$. In each interval all but $O(h^2L^4/G)=o(h)$ odd classes contain $\gg G/(hL)$ primes. Translation by $n$ permutes the odd classes. Consequently there are $\gg G^2/(hL^2)$ prime pairs $(g,j)$ in the respective intervals with $j-g\equiv n\pmod h$. There are $O(G/h)$ possible differences. Some fixed $\Delta<0$ therefore gives $\gg G/L^2$ primes $g$ with $j=g+\Delta$ prime. Omit the $O(1)$ primes $t\in\T$ dividing $n-\Delta$. For any remaining $t$, seek primes $p\in[P,2P]$ satisfying \begin{equation}\label{eq:congruences} p\equiv-1\pmod h,\qquad (p+1)g\equiv n-\Delta\pmod t,\qquad p+1\in\A . \end{equation} We claim that among the $t$ classes modulo $ht$ over $-1\bmod h$, all but \begin{equation}\label{eq:lost-classes} O\!\left(1+\frac{(ht)^2L^4}{P}+\frac{h^2htL^3}{P}\right) =o(t/L^2) \end{equation} contain $\gg P/(htL)$ primes $p$ with $p+1\in\A$. There is one unreduced class. By the long-interval estimate for $\theta$, at most $O((ht)^2L^4/P)$ reduced classes have prime weight below a sufficiently small multiple of $P/(ht)$. Each remaining class has $\gg P/(htL)$ primes. By Lemma~\ref{lem:bases} at scale $P$, at most $O(h^2L^2)$ of the possible multiples $p+1$ lie outside $\A$. Depleting a class by a fixed fraction of the lower bound for its primes costs $\gg P/(htL)$ such deletions. This proves \eqref{eq:lost-classes}. Each eligible $g$ is a prime greater than $t$. Since $t\nmid n-\Delta$, the map $g\mapsto (n-\Delta)g^{-1}-1\bmod t$ is injective on nonzero residues. A class excluded in \eqref{eq:lost-classes} therefore costs at most $1+G/t$ choices of $g$. We retain $\gg G/L^2$ primes $g$, each with $\gg P/(htL)$ choices of $p$ satisfying \eqref{eq:congruences}. For each choice, let \[ m=pg+j=(p+1)g+\Delta . \] The ranges give $M\le m\le5M$, and the two congruences give $m\equiv n\pmod{ht}$. At base $p$, weight zero is available since $p$ is prime, and weight one is available since $p+1\in\A$ gives a complete design of order $p+1$. In a master of prime order $g$ use $j$ ones and $g-j$ zeros. Here $j\le g$ and $j>k+1$ is prime, so \eqref{eq:weighted} gives $N(m)\ge k$. Each $m$ arises $O(1)$ times for fixed $t$, because $g$ is a prime divisor of $m-\Delta$ at least $G$, and $g$ determines $p$ and $j$. Thus we have $\gg M/(htL^3)$ distinct $m$ for each retained $t$. Summing over $\gg h/L$ such primes proves the lemma. \end{proof} \begin{proof}[Proof of Theorem~\ref{thm:main}] Fix an absolute $B\ge1$, to be chosen below, and suppose $Bk^5L^{20}\le n\le2Bk^5L^{20}$. Set $M=n/(10^4h)$ and let $\T$ be the primes in $[8h,16h]$. We first find $\gg M/(hL^4)$ pairs $(t,m)$ with $t\in\T$, $M\le m\le5M$, $m\equiv n\pmod{ht}$, and $N(m)\ge k$. For even $n$ this is Lemma~\ref{lem:even}. Suppose $n$ is odd. Omit the $O(1)$ primes $t\in\T$ dividing $n$. For each remaining $t$ the class $n\bmod{ht}$ is reduced. Applying \eqref{eq:long} to $\theta$ at $M$ and $2M$ gives \[ \theta(2M;ht,n)-\theta(M;ht,n)=\frac{M}{\ph(ht)}+O(\sqrt M\,L^2). \] Since $ht\asymp k^2$ and $M\asymp Bk^4L^{20}$, the main term dominates the error. Thus each $t$ gives $\gg M/(htL)$ primes $m\in(M,2M]$, each with $N(m)=m-1\ge k$. Summing over the $\gg h/L$ remaining primes $t$ gives the required number of pairs. For each pair, $A=(n-m)/t$ is a multiple of $h$ of size $\asymp M$. At this scale $C_0h^4L^4\ll M$, so Lemma~\ref{lem:bases} gives $A\in\A$ for every candidate. Also $m\le5M\le(n-m)/(100h)=At/(100h)$. It remains to find a candidate for which $N(A+1)\ge k$. The values $A+1$ lie in one odd class modulo $h$, in a bounded number of dyadic intervals at scale $M$. These intervals have lower endpoints between $k^4$ and $k^6$ for sufficiently large $k$. Proposition~\ref{prop:odd} thus excludes $O(h\sqrt M\,L^6)$ possible values of $A+1$. For fixed $A$, the condition $M\le n-At\le5M$ restricts $t$ to an interval of length $4M/A=O(1)$. The same bound counts the pairs lost. The proportion of pairs excluded is \[ \ll \frac{h\sqrt M\,L^6}{M/(hL^4)} = \frac{h^2L^{10}}{\sqrt M}\ll B^{-1/2}. \] The implied constants are absolute for sufficiently large $k$ depending on $B$. Choose $B$ so that a pair survives. Lemma~\ref{lem:transfer} then gives $N(n)\ge k$. Finally take $k$ maximal with $Bk^5\log(2k)^{20}\le n$. Successive values of $k^5\log(2k)^{20}$ have ratio tending to one, so $n$ lies in the required interval and \[ k\asymp \frac{n^{1/5}}{(\log n)^4}. \qedhere \] \end{proof} The powers $1/4$ and $1/5$ reflect the orders of the designs used in the proof. The local construction begins with $a=h(2h-1)\asymp k^2$. The first affine design uses a prime $p>2r+1$, so its order after weighting is at least $ap\gg k^3$. The master of order $t\ge r$ then produces targets of size at least a constant times $k^4$. For the uniform bound the odd-order estimate is applied at scale $n/h$. This last use accounts for the fifth power of $k$. \begin{thebibliography}{99} \small \bibitem{beth} T. Beth, Eine Bemerkung zur Absch\"atzung der Anzahl orthogonaler lateinischer Quadrate mittels Siebverfahren, \emph{Abh. Math. Sem. Univ. Hamburg} \textbf{53} (1983), 284--288. \bibitem{bsp} R.~C. Bose, S.~S. Shrikhande and E.~T. Parker, Further results on the construction of mutually orthogonal Latin squares and the falsity of Euler's conjecture, \emph{Canad. J. Math.} \textbf{12} (1960), 189--203. \bibitem{bds} S. Boyadzhiyska, S. Das and T. Szab\'o, Enumerating extensions of mutually orthogonal Latin squares, \emph{Des. Codes Cryptogr.} \textbf{88} (2020), 2187--2206. \bibitem{bvr} A.~E. Brouwer and G.~H.~J. van Rees, More mutually orthogonal Latin squares, \emph{Discrete Math.} \textbf{39} (1982), 263--281. \href{https://doi.org/10.1016/0012-365X(82)90149-2}{doi:10.1016/0012-365X(82)90149-2}. \bibitem{ces} S. Chowla, P. Erd\H{o}s and E.~G. Straus, On the maximal number of pairwise orthogonal Latin squares of a given order, \emph{Canad. J. Math.} \textbf{12} (1960), 204--208. \bibitem{erdos} P. Erd\H{o}s, On the combinatorial problems which I would most like to see solved, \emph{Combinatorica} \textbf{1} (1981), 25--42. \bibitem{gy} D.~A. Goldston and C.~Y. Y{\i}ld{\i}r{\i}m, Primes in short segments of arithmetic progressions, \emph{Canad. J. Math.} \textbf{50} (1998), 563--580. \href{https://doi.org/10.4153/CJM-1998-031-9}{doi:10.4153/CJM-1998-031-9}. \bibitem{lu} M.~G. Lu, The maximum number of mutually orthogonal Latin squares, \emph{Kexue Tongbao (English Ed.)} \textbf{30} (1985), 154--159. \bibitem{macneish} H.~F. MacNeish, Euler squares, \emph{Ann. of Math.} (2) \textbf{23} (1922), 221--227. \bibitem{mv} H.~L. Montgomery and R.~C. Vaughan, \emph{Multiplicative Number Theory I. Classical Theory}, Cambridge University Press, Cambridge, 2007. \href{https://doi.org/10.1017/CBO9780511618314}{doi:10.1017/CBO9780511618314}. \bibitem{rogers} K. Rogers, A note on orthogonal Latin squares, \emph{Pacific J. Math.} \textbf{14} (1964), 1395--1397. \bibitem{wilson} R.~M. Wilson, Concerning the number of mutually orthogonal Latin squares, \emph{Discrete Math.} \textbf{9} (1974), 181--198. \end{thebibliography} \end{document}