---
title: Prime-Detecting Quasimodular Forms
url: https://www.emergentmind.com/topics/prime-detecting-quasimodular-forms
type: topic
---

# Prime-Detecting Quasimodular Forms

Prime-detecting quasimodular forms are holomorphic \(q\)-series in the quasimodular framework whose Fourier coefficients vanish exactly at prime indices, or at primes in specified arithmetic progressions in higher-level variants. The subject emerged from identities for MacMahon partition functions and was subsequently given a structural classification: at level \(1\), every prime-detecting quasimodular form lies in the quasimodular Eisenstein space, while in higher levels the allowable non-Eisenstein contribution is constrained to quasimodular oldforms. Alongside these arithmetic constructions, recent work has identified non-arithmetic sources of quasimodularity—most notably from random matrix theory—that explicitly suggest possible adaptations to prime-detection [2507.20432], [2601.21267].

## 1. Definition and ambient algebra

For \(\tau\in\mathbb H\) and \(q=e^{2\pi i\tau}\), a quasimodular form on \(\mathrm{SL}_2(\mathbb Z)\) is a holomorphic \(q\)-series
\[
f(\tau)=\sum_{n\ge0} b_n(f)q^n
\]
lying in the polynomial ring
\[
\widetilde M=\mathbb C[G_2,G_4,G_6],
\]
with the differential operator
\[
D:=\frac{1}{2\pi i}\frac{d}{d\tau}=q\frac{d}{dq}
\]
acting on Fourier expansions by \(D^m:q^n\mapsto n^m q^n\). The mixed-weight subspace
\[
\widetilde M_{\le k}=\bigoplus_{0\le j\le k,\ j\equiv k\!\!\pmod 2}\widetilde M_j
\]
consists of finite sums of pure-weight quasimodular forms of weights \(\le k\) [2507.20432].

In the level-\(1\) theory, a quasimodular form \(f(\tau)=\sum_{n\ge0} b_n(f)q^n\) is called **prime-detecting** if
\[
b_n(f)\ge0\quad\text{for all positive integers }n,
\]
and for all integers \(n\ge2\),
\[
b_n(f)=0 \iff n\text{ is prime}.
\]
The set of such forms is denoted \(\Omega\). The quasimodular Eisenstein space \(\mathcal E\) is the additive span of even weight Eisenstein series and their derivatives. A larger space,
\[
\widetilde\Omega:=\{f\text{ quasimodular}\mid c_f(p)=0\text{ for every prime }p\},
\]
is used in the structural proofs because vanishing at all prime indices is easier to analyze than the full nonnegativity condition [2507.00147].

At higher level \(N\), the ambient ring becomes \(\widetilde M(N)\), the algebra of quasimodular forms on \(\Gamma_0(N)\). A quasimodular form
\[
f(\tau)=\sum_{n=0}^\infty a_f(n)q^n
\]
is **prime-detecting** on \(\Gamma_0(N)\) if for every integer \(n\ge2\),
\[
a_f(n)=0 \quad\Longleftrightarrow\quad n\text{ is prime and } n\nmid N.
\]
The corresponding larger vanishing space is
\[
\widetilde\Omega_N=\Bigl\{f\in\widetilde M(N): a_f(p)=0\text{ for every prime }p\nmid N\Bigr\}
\]
[2601.21267].

## 2. Partition-theoretic origin

The first explicit prime-detecting examples arose from MacMahon’s partition functions. For \(a\ge1\),
\[
\mathcal U_a(q)=\sum_{n\ge1}M_a(n)q^n:=\sum_{0<s_1<s_2<\cdots<s_a}\frac{q^{s_1+\cdots+s_a}}{(1-q^{s_1})^2\cdots(1-q^{s_a})^2}.
\]
These functions produce weighted partition statistics whose linear combinations detect primes. Two basic identities are:
\[
(n^2-3n+2)M_1(n)-8M_2(n)\ge0,
\]
with vanishing for \(n\ge2\) iff \(n\) is prime, and
\[
(3n^3 - 13n^2 + 18n - 8)M_1(n) + (12n^2 - 120n + 212)M_2(n) -960M_3(n)\ge 0,
\]
again vanishing exactly when \(n\) is prime. More generally, for the MacMahonesque functions
\[
M_{\vec a}(n):=\sum_{\substack{0<s_1<\cdots<s_a\\ m_1,\dots,m_a>0\\ n=m_1s_1+\cdots+m_as_a}} m_1^{v_1}\cdots m_a^{v_a},
\]
there are infinitely many inequalities of the shape
\[
\sum_{|\vec a|\le d} c_{\vec a}\,M_{\vec a}(n)\ge0
\]
whose vanishing set, for \(n\ge2\), is precisely the primes. The key structural statement is that these expressions are Fourier coefficients of specific quasimodular forms built from Eisenstein series and their derivatives [2507.20432].

The same mechanism persists in higher-level MacMahon variants. For the level-\(2\) functions \(M_k^{(2)}(n)\), the paper on quasi-modularity in MacMahon partition variants gives exact odd-prime detectors:
\[
(n^2-4n+3)M_1^{(2)}(n)-24M_2^{(2)}(n)
\begin{cases}
=0 &\text{if \(n\) is an odd prime},\\
<0 &\text{if \(n=2^l\) for some \(l\ge1\)},\\
>0 &\text{otherwise},
\end{cases}
\]
and
\[
(n^4-n^3-14n^2+29n-15)M_1^{(2)}(n)-120(3n-8)M_2^{(2)}(n)-5760M_3^{(2)}(n)
\]
with the same sign pattern. At level \(3\), an analogous formula is
\[
(n^2-3n+2)M_1^{(3)}(n)-12M_2^{(3)}(n),
\]
which vanishes for primes except \(3\), is negative on powers of \(3\), and positive otherwise [2412.19180].

These constructions are not merely combinatorial. They depend on realizing the generating functions as quasimodular forms and then transporting prime-detecting sign patterns through the operator \(D=q\frac{d}{dq}\), Eisenstein expansions, and higher-level analogues of divisor sums [2412.19180].

## 3. Level-\(1\) classification

The decisive structural result at level \(1\) is that prime-detecting quasimodular forms are Eisenstein. Writing \(\mathcal E\) for the quasimodular Eisenstein space and \(\Omega\) for the prime-detecting forms, the main theorem is
\[
\Omega=\mathcal E\cap\Omega.
\]
Equivalently, any prime-detecting quasimodular form must lie in \(\mathcal E\); there are no cuspidal contributions, including derivatives of cusp forms. Moreover, for even \(k\ge6\), the distinguished forms
\[
H_k(\tau)=\sum_{n\ge0} b_n(H_k)\,q^n
\]
are defined by
\[
H_6(\tau)=\frac{1}{6}\big((D^2-D+1)G_2-G_4\big),
\]
and, for \(k\ge8\),
\[
H_k(\tau)=\frac{1}{24}\big(-D^2G_{k-6}+(D^2+1)G_{k-4}-G_{k-2}\big).
\]
The classification then becomes explicit:
\[
D^nH_k\in\Omega \quad\text{for all }n\ge0,\ k\ge6\text{ even},
\]
and conversely every \(f\in\Omega\) is a linear combination of the forms \(D^nH_k\) [2507.20432].

Two complementary proofs are now available. The analytic proof shows that if \(F\) is a nonzero quasimodular cusp form with real Fourier coefficients, then the sequence \(c_F(p)\), as \(p\) runs over primes, has infinitely many sign changes. By contrast, for \(f\in\mathcal E\), the signs of \(c_f(p)\) stabilize for sufficiently large primes. This dichotomy forces the cuspidal part of any \(f\in\widetilde\Omega\) to vanish, hence \(\widetilde\Omega=\mathcal E\cap\widetilde\Omega\), and therefore \(\Omega=\mathcal E\cap\Omega\) [2507.00147].

The alternative proof uses \(\ell\)-adic Galois representations attached to cusp forms. It shows that the large image of residual Galois representations forces enormous flexibility in the values of cusp-form coefficients at primes in arithmetic progressions, incompatible with the rigid vanishing pattern required by prime detection. In this form, the theorem becomes a statement about the incompatibility between prime-detecting coefficient patterns and nontrivial cuspidal Galois data [2507.20432].

## 4. Higher levels and arithmetic progressions

Higher level introduces two distinct modifications. First, prime-detecting quasimodular forms need not be Eisenstein. Second, arithmetic progressions become intrinsic to the problem.

For \(\Gamma_0(N)\), the quasimodular cusp space decomposes into quasimodular new and quasimodular old parts,
\[
\widetilde S(N)=\widetilde S^{\mathrm{new}}(N)\oplus \widetilde S^{\mathrm{old}}(N),
\]
and the main structural theorem is
\[
\widetilde\Omega_N=\widetilde\Omega_N\cap\bigl(\widetilde E(N)\oplus \widetilde S^{\mathrm{old}}(N)\bigr).
\]
Thus any quasimodular form on \(\Gamma_0(N)\) whose coefficients vanish at all primes \(p\nmid N\) has no quasimodular new cuspidal component. As a corollary, every prime-detecting quasimodular form on \(\Gamma_0(N)\) belongs to the direct sum of the quasimodular Eisenstein space and the quasimodular old space [2601.21267].

This refinement is necessary because higher level genuinely admits non-Eisenstein examples. If \(f_{k,\ell}^{(N)}\) is one of the quasimodular Eisenstein prime detectors constructed from generalized divisor sums, and \(d\mid N\) with \(d>1\), then
\[
f_{k,\ell}^{(N)}(\tau)+\Delta(d\tau)
\]
is still prime-detecting on \(\Gamma_0(N)\), but its cuspidal part is \(\Delta(d\tau)\neq0\). The point is that \(\Delta(d\tau)\) is an oldform, so it does not contradict the theorem [2601.21267].

For arithmetic progressions, the natural language is that of sieving operators. On \(\Gamma_1(N)\), the operator
\[
f\big|S_{M,m}(\tau):=\sum_{n\equiv m\pmod M} c_f(n)q^n
\]
projects a quasimodular form to one residue class modulo \(M\). The spaces \(\widetilde\Omega_{m,M}(\Gamma_1(N))\) and \(\Omega_{m,M}(\Gamma_1(N))\) encode vanishing at primes \(p\equiv m\pmod M\), and the main structural theorem shows that, after applying the relevant sieves \(S_{M,m}\) and \(S_{N,n}\), the visible part of a prime-detecting form is Eisenstein. The spanning sets are built from differences of forms
\[
H_{k,\ell,\chi,\psi}:=\overline{\chi(m)}\,D^{\ell-1}E_{k,\psi,\chi}-\psi(m)\,E_{\ell,\overline{\psi},\overline{\chi}},
\]
which are designed so that the \(p\)-th Fourier coefficient cancels for primes \(p\equiv m\pmod M\) [2511.04030].

## 5. Related quasimodular mechanisms outside arithmetic detection

A distinct but closely related development comes from random matrix theory. Hypergeometric functions of complex matrices, viewed as holomorphic observables of the Circular Unitary Ensemble, give large-\(N\) cumulant expansions whose genus-\(g\) generating functions are quasimodular forms. In the randomized HCIZ case, one has
\[
L_N(q)\sim\sum_{g\ge1}N^{2-2g}F_g(q),
\]
with
\[
F_g(q)\in\mathbb C[E_2,E_4,E_6]\qquad (g\ge2),
\]
and
\[
F_1(q)=\sum_{n\ge1}\log\frac{1}{1-q^n}.
\]
The coefficients are governed by monotone Hurwitz numbers and Bloch–Okounkov averages of symmetric functions in partition contents [2410.04243].

This construction is explicitly described as non-arithmetic, but structurally very close to classical number-theoretic appearances of quasimodular forms. The same work states that the framework can plausibly be adapted to questions with arithmetic content, such as prime-detection. A plausible implication is that prime-detecting quasimodular forms may admit constructions that pass through symmetric-group factorizations, content polynomials, and Bloch–Okounkov averages rather than beginning directly from partition inequalities [2410.04243].

The significance of this connection is methodological rather than classificatory. It does not produce prime-detecting forms, but it enlarges the known range of quasimodular mechanisms that might support such forms.

## 6. Scope, misconceptions, and constraints

Prime-detecting quasimodular forms should not be conflated with other prime-related phenomena in the theory of quasimodular forms. One such phenomenon concerns extremal quasimodular forms. Their Fourier coefficients satisfy strong denominator restrictions: for normalized extremal forms of small depth, the denominators involve only primes less than the weight. This is a statement about prime factors in denominators, not about vanishing of coefficients at prime indices [2005.06882].

A second distinction is asymptotic. For extremal quasimodular forms of depth \(\le4\), the coefficients are eventually positive and are governed by Eisenstein-dominated asymptotics built from divisor sums. In particular, all but finitely many Fourier coefficients are positive, and the leading terms have the shape of weighted divisor sums rather than sparse prime-indicator behavior. This rules out any direct prime-detecting interpretation for extremal quasimodular forms in the sense used for \(\Omega\) [2007.13569].

Within the prime-detecting theory itself, the central misconception is that cuspidal pieces might be used to sharpen detection. The level-\(1\) classification shows the opposite: cusp forms are excluded because their prime-index coefficients are too oscillatory. In higher level, cusp forms can persist only through oldforms or through components annihilated by the relevant sieving operators. Prime detection is therefore rigidly tied to Eisenstein structure, with oldform corrections appearing only when the level creates invisible directions [2507.00147], [2601.21267].

The current picture is therefore sharply stratified. At level \(1\), prime-detecting quasimodular forms are exactly the linear combinations of \(D^nH_k\). At higher level, the visible part in any arithmetic progression is Eisenstein, while the full space may include quasimodular oldforms. Separate non-arithmetic constructions from random matrices show that quasimodularity itself is much broader than its presently known prime-detecting realizations, and this suggests that the next advances are likely to come from new ways of encoding arithmetic data into already established quasimodular frameworks [2507.20432], [2511.04030], [2410.04243].

Source: https://www.emergentmind.com/topics/prime-detecting-quasimodular-forms