Let $S$ be an infinite set of positive integers, and $T=S+S=\{x+y, \mbox{ with } x,y\in S\}$.We definte the following functions:


* $N\_S(z)$ is asymptotic continuous version of the function counting the number of elements in $S$ less or equal to $z$.
* $N'\_S(z)$, the derivative of $N\_S(z)$, is the "probability" for $z$
(an integer) to belong to $S$
* $r(z)$ is the asymptotic continuous version of the function counting
the number of solutions $x+y \leq z$ with $x,y\in S$.
* $r'(z)$ is the derivative of $r(z)$.


We will work with
$$N\_S(z) \sim \frac{az^b}{(\log z)^c}.$$


Here $\frac{1}{2}< b \leq 1$ and $a>0, c\geq 0$. The case $b=1, c=0$ should be excluded. This covers a vast array of sets: sums of primes, sums of super-primes etc. The following is a known result (see [here](https://mathoverflow.net/questions/364559/general-asymptotic-result-in-additive-combinatorics-sums-of-sets)):


$$r(z) \sim \frac{a^2 z^{2b}}{(\log z)^{2c}}\cdot \frac{\Gamma^2(b+1)}{\Gamma(2b+1)}$$
$$r'(z) \sim \frac{a^2 z^{2b-1}}{(\log z)^{2c}}\cdot \frac{\Gamma^2(b+1)}{\Gamma(2b)}$$


More generally (see [here](https://mathoverflow.net/questions/363055/goldbach-conjecture-and-other-problems-in-additive-combinatorics/)):


$$r(z) \sim z\int\_0^{1} N\_S(z(1-v))N'\_S(zv) dv.$$
$$r'(z) \sim z\int\_0^{1} N'\_S(z(1-v))N'\_S(zv) dv .$$


Since $b>\frac{1}{2}$, we have $r'(z) \rightarrow \infty$ as $z\rightarrow \infty$. This guarantees (it's a conjecture) that barring congruence restrictions, $T = S + S$ contains all the positive integers except a finite number of them. The inversion formula is as follows:


**Inversion formula**


$$N\_T(z) = z-w(z), \mbox{ with } w(z) \sim \int\_0^z \exp\Big(-\frac{1}{2} r'(u)\Big)du.$$


Since $r'$ is a function of $N'$ and thus, a function of $N$, we have a formula linking $N\_T$ to $N\_S$. So if you know $N\_T$, by inversion (it involves solving an integral equation, though we are only interested in the asymptotic value of the solution) technically, you can retrieve $N\_S$, assuming the solution is unique (chances are that the solution is far from unique.)


Note that ***$w(z)$ represents the number of positive integers, less or equal to $z$, that do not belong to $T=S+S$. These integers are called ***exceptions***; **$w(\infty)$ is finite and represents an estimate of the total number of exceptions*****. I tried to assess the validity of the inversion formula using some test sets $S$, and empirical evidence suggests that it is correct. Essentially, it is based on the following simple probabilistic argument (see proof in my answer to this post). Let $u(z)$ be the probability that $z$ (an integer) is an exception. Then, if $r'(z)\rightarrow\infty$ as $z\rightarrow\infty$ and $S$ is free of congruence restrictions and other sources of non-randomness, then  

$$u(z) \sim \exp\Big(-\frac{1}{2}r'(z)\Big).$$


**Testing the formula on an example**


I created 100 test sets $S$, with $a=1, b=\frac{2}{3}, c=0$, as follows: an integer $k$ belongs to $S$ if and only if $U\_k<N'\_S(k)$, where the $U\_k$'s are independent uniform deviates on $[0, 1]$. I computed various statistics, but I will mention only one here. The theoretical value for $w(\infty)$ is
$$w(\infty) \approx \int\_0^\infty \exp\Big(-\frac{\lambda}{2}u^{1/3}\Big)du \approx 63.76, \mbox{ with } \lambda = \frac{\Gamma^2(\frac{5}{3})}{\Gamma(\frac{4}{3})}.$$


Note that the above integral can be computed explicitly. I then conjectured the value $w(\infty)$ for each of the 100 test sets. It ranged from $13$ to $199$, with an average value of $65.88$. Again, $w(\infty)$ is an estimate of the number of exceptions, that is, positive integers that can not be represented as $x+y$ with $x, y \in S$. So the approximate theoretical value is in agreement with the average value inferred from my experiment.


**My question**


Is this inversion formula well known? Can it be of any practical use? Can it be further refined, maybe generalized to sums of three sets or made more accurate with bounds on the error term?



Curious inversion formula in additive combinatorics
This is not an answer to the question, but an explanation as to how I came up with the formula for $w(z)$. We assume here that $S$ is a random set. That is, let us consider $X\_z$ as a Bernouilli random variable of parameter $N'\_S(z)$. A positive integer $z$ belongs to $S$ if and only if $X\_z = 1$. Thus $P(z\in S) = N'\_S(z)$.


Now we compute $u(z)=P(z\notin S + S)$ when $z$ is an odd positive integer. We have:


$$u(z) = \Big[\prod\_{k=0}^z P(k\notin S \mbox{ or } z-k \notin S)\Big]^{1/2}.$$


The exponent $\frac{1}{2}$ is because we count $k + (z-k)$ and $(z-k) + k$ as two solutions when it should appear only once in the product. The following is easy to derive from the above product:


$$u(z) = \Big[\prod\_{k=0}^z \Big(1-N'\_S(k)N'\_S(z-k) \Big)\Big]^{1/2}.$$


Thus $$\log u(z)=\frac{1}{2}\sum\_{k=0}^z \log\Big(1-N'\_S(k)N'\_S(z-k) \Big).$$


Note that since $b\geq \frac{1}{2}$, either $N'\_S(k)$ or $N'\_S(z-k)$ tends to zero in the product when $z\rightarrow\infty$, so we have the approximation


$$\log\Big(1-N'\_S(k)N'\_S(z-k) \Big) \approx -N'\_S(k)N'\_S(z-k).$$


Also,


$$\sum\_{k=0}^z N'\_S(k)N'\_S(z-k) \sim \int\_0^z N'\_S(v)N'\_S(z-v)dv 
= z\cdot\int\_0^1 N'\_S(z(1-v))N'\_S(zv)dv\sim r'(z).$$


It follows immediately that
$$u(z) \approx \exp\Big[-\frac{1}{2} r'(z)\Big].$$


Similar reasoning for the case "$z$ even" leads to the same result. To complete the proof, note that


$$w(z)=\sum\_{k=0}^z u(k) \sim \int\_0^z u(v) dv \approx \int\_0^z \exp\Big[-\frac{1}{2} r'(v)\Big] dv.$$


**Some open problems**


Let $R$ be the set of exceptions, that is, the finite set of positive integers that can not be written as $z=x+y$ with $x,y \in S$. Let


* $Y\_z$ be a bernouilli random variable of parameter $u(z)$, such that $z\in R$ if and only if $Y\_z=1$
* $N\_R(z)=Y\_0 + Y\_1 +\cdots + Y\_z$ be the number of exceptions less or
equal to $z$
* $N\_R(\infty)<\infty$ be the total number of exceptions
* $M\_R$ be the largest exception ($M\_R=k$ if and only if $Y\_k=1$ and $Y\_{k+n}=0$ for $n>0$).


All these variables are random variables. We have established (see above) that $$w(z) = E[N\_R(z)] \approx \int\_0^z \exp(-r'(v)/2) dv.$$


The big challenge here to make further progress is that the $Y\_z$'s are not independent. Problems to investigate are


* What are the variances of $N\_R(z), N\_R(\infty)$ and $M\_R$? (they are
finite)
* What is the expectation of $M\_R$? (it is finite)
* Are $N\_R(\infty)$ and $M\_R$ bounded random variables? If yes, what are the upper bounds?


The fact that $E[N\_R(\infty)]$ is bounded does not imply that $N\_R(\infty)$ is bounded. It may or may not be the case depending on $a, b, c$. If we had a positive answer to that question, we could make a tiny bit of progress towards proving Golbach's conjecture ($a=1,b=0,c=1$), though there are other big hurdles to overcome (the fact that primes are not random enough, for instance the sum of two odd primes is never an odd number).


Note that the Central Limit Theorem does not apply to $N\_R(z)=Y\_0+\cdots +Y\_z$ because of auto-correlations in the $Y\_k$'s, and especially the fact that $\mbox{Var}[N\_R(z)]$ is bounded no matter how large $z$ is. It is very obvious based on empirical evidence that $(N\_R(z)-E[N\_R(z)])/\sqrt{\mbox{Var}(N\_R(z))}$ does not tend to a Gaussian variable as $z\rightarrow\infty$, even if $S$ is a very thin set (e.g. $a=\frac{1}{100}, b=0.50001, c=200$) resulting in a very, very, very large yet finite $E[N\_R(\infty)]$. Similar examples of lack of convergence to a Gaussian distribution are illustrated in one of my articles, see [here](https://www.datasciencecentral.com/profiles/blogs/the-fundamental-statistics-theorem-revisited).


A possible approach is to use the Borel-Cantelli lemma, or a sharper version of it to the set $R$, see [here](https://projecteuclid.org/euclid.aop/1176996800). Then, since $\sum\_{z=1}^\infty u(z) < \infty$, it follows that with probability 1 (that is, almost surely), $Y\_z=1$ only for finitely many integer $z$'s, and thus both $N\_R(\infty)$ and $M\_R$ are almost surely finite.


