Sieve theory through variational principles Disclaimer: I'm just starting to read Sieve Methods by Halberstam and Richert, so my present knowledge of the subject is close to zero, but it made me wonder if some connection to physics could exist, so I dare share this question here.
As I said, I'm reading Halberstam and Richert's book on sieve theory, and as of now I just try to understand the very principle of sieving (sifting? Some help with English would be welcome too) a set of numbers.
Still, it seems one wants to minimize the error term in estimating the size of the considered set, so what we deal with is an optimization problem. That made me wonder if some variational principle like the maximal entropy principle or the least action principle which are widely used in physics could be used: namely can one define some "sieve action" from first principles depending on the specific problem to be solved, and whose extremum would lead to an optimal result?
What kind of mathematical tools would its implementation require? Have such ideas been suggested so far? If yes, could I get relevant references?
 A: As suggested in the comment by Stanley Yao Xiao, Selberg's choice of $\lambda_d$ in his clever upper bound sieve is an application of a "discrete" variational principle. This answer is going to present another concept arising from sieve theory that may possibly be connected with physics.
In physics, objects are studied via differential equations, and in analytic number theory theory, sieves can be studied via differential-difference equations.
In 1964, Ankeny and Onishi proved that if $\sigma(u)$ is the solution to the IVP that
$$
\sigma(u)={e^{-\gamma\kappa}\over\Gamma(\kappa+1)}\left(\frac u2\right)^\kappa\quad(0<u\le2),
$$
$$
[u^{-\kappa}\sigma(u)]'=-\kappa u^{-\kappa-1}\sigma(u-2)\quad(u>2),
$$
then we have
Theorem (Ankeny & Onishi, 1964; Halberstam & Richert, 1974): For $u>0$, if $\nu(d)$ denote the number of distinct prime divisors of $d$, $\omega(d)$ is a multiplicative function and $X,R_d$ are numbers satisfying
$$
|\mathcal A_d|={\omega(d)\over d}X+R_d,
$$
$$
-L\le\sum_{w\le p<z}{\omega(p)\log p\over p}-\kappa\log\frac zw\le O(1),
$$
then
$$
S(\mathcal A,\mathcal P,z)<X\prod_{p<z}\left(1-{\omega(p)\over p}\right)\left\{{1\over\sigma(u)}+O\left(L\cdot{u^{2\kappa}+u^{-\kappa-1}\over\log z}\right)\right\}+\sum_{\substack{p|d\Rightarrow p<z\\d<z^u}}3^{\nu(d)}|R_d|
$$
