\documentclass[11pt]{amsart} \usepackage[margin=1.15in]{geometry} \usepackage{amsmath,amssymb,amsthm} \usepackage{booktabs} \usepackage{array} \usepackage[hidelinks]{hyperref} \DeclareUnicodeCharacter{2115}{\ensuremath{\mathbb{N}}} \DeclareUnicodeCharacter{211D}{\ensuremath{\mathbb{R}}} \DeclareUnicodeCharacter{2211}{\ensuremath{\sum}} \DeclareUnicodeCharacter{2208}{\ensuremath{\in}} \DeclareUnicodeCharacter{230A}{\ensuremath{\lfloor}} \DeclareUnicodeCharacter{230B}{\ensuremath{\rfloor}} \DeclareUnicodeCharacter{208A}{\ensuremath{{}_{+}}} \DeclareUnicodeCharacter{2200}{\ensuremath{\forall}} \DeclareUnicodeCharacter{2203}{\ensuremath{\exists}} \DeclareUnicodeCharacter{2227}{\ensuremath{\wedge}} \DeclareUnicodeCharacter{2264}{\ensuremath{\le}} \DeclareUnicodeCharacter{0393}{\ensuremath{\Gamma}} \numberwithin{equation}{section} \newtheorem{theorem}{Theorem}[section] \newtheorem{proposition}[theorem]{Proposition} \newtheorem{lemma}[theorem]{Lemma} \newtheorem{corollary}[theorem]{Corollary} \theoremstyle{definition} \newtheorem{definition}[theorem]{Definition} \theoremstyle{remark} \newtheorem{remark}[theorem]{Remark} \newtheorem*{mainsum}{Theorem A} \newtheorem*{maincount}{Theorem B} \newtheorem*{mainfind}{Theorem C} \newcommand{\Z}{\mathbb{Z}} \newcommand{\N}{\mathbb{N}} \newcommand{\C}{\mathbb{C}} \newcommand{\R}{\mathbb{R}} \newcommand{\e}{\mathrm{e}} \newcommand{\lean}[1]{\texttt{#1}} \newcommand{\Log}{\operatorname{Log}} \DeclareMathOperator{\re}{Re} \DeclareMathOperator{\im}{Im} \DeclareMathOperator{\sgn}{sgn} \newcommand{\floor}[1]{\lfloor #1\rfloor} \newcommand{\abs}[1]{\lvert #1\rvert} \newcommand{\Units}{\mathcal U} \title[Prime counting and prime finding in time $N^{o(1)}$]% {Exact prime counting and deterministic prime finding in time $N^{o(1)}$} \author{Jiayan Ni} \address{Cornell University, Ithaca, NY 14853, United States} \email{jn577@cornell.edu} \date{November 21, 2026} \begin{document} \sloppy \begin{abstract} We prove that the exact sum $S(N)=\sum_{p\le N}p$ of the primes up to $N$, the exact prime count $\pi(N)$ and, for $N\ge1$, a prime in $(N,2N]$ can each be computed by a deterministic Turing machine in $2^{O(b/\sqrt{\log b})}=N^{o(1)}$ steps, where $b$ is the bit length of $N$. For all three problems the best bounds known so far were $N^{1/2+o(1)}$; for $\pi(N)$ this exponent has stood since the analytic method of Lagarias and Odlyzko in 1987. In particular, whether a given interval in $[N,2N]$ contains a prime can be decided in time $N^{o(1)}$. This establishes, in a much stronger form, a conjecture of the Polymath4 project, which asked for time $N^{1/2-c}$ for some $c>0$ and for intervals of length at most $N^{1/2+c}$. The theorems are obtained by reducing the three problems to the subexponential counting algorithm behind the recent refutation of the Exponential Time Hypothesis; they are asymptotic statements, not practical algorithms. The reduction rests on an analytic idea: Ramanujan sums express the M\"obius function without factoring, and a Cauchy-kernel quadrature turns the phases, the logarithm and its reciprocal into short linear combinations of rational functions, which a counting network of linear size can evaluate. All three theorems, together with the counting algorithm they rely on, are formally verified in Lean~4 against a specification that imports only Mathlib. \end{abstract} \maketitle \tableofcontents \input{sections/intro} \input{sections/engine} \input{sections/formula} \input{sections/quadrature} \input{sections/rounding} \input{sections/coefficients} \input{sections/network} \input{sections/machines} \input{sections/formal} \input{sections/remarks} \subsection*{AI assistance} Generative AI tools were used extensively in this work. GPT~6 Astra assisted in developing the algorithmic constructions that connect the counting engine of \cite{A} to the prime-sum, prime-counting and prime-finding results. GPT~6 Astra and Claude Fable~5.2 played the main role in the Lean~4 formalization. AI also assisted in the writing process of the paper. The author takes full responsibility for the content of the paper. The correctness of Theorems~A--C rests on the formal verification described in Section~\ref{sec:formal} rather than the natural language exposition of the paper. \input{sections/references} \end{document}