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):

$$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):

$$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?