I don't think it will be easy to derive the relationship in a simple manner here, however, if you really want a mathematical and statistical derivation you can find it in Appendix A of this paper.
That being said, I can try to simplify the method in a way you can digest it.
If you take many output samples of a sine wave input into a converter, you can derive some of the properties of the converter by creating a histogram of the data points binned at values separated by one lsb (of the converter).
Having knowledge of the probability density function of the sin based histogram, one can calculate the expected number of points that should fall in each bin. If you have that knowledge then you can compare the actual number of points that fall into each lsb bin to the expected number of points. Using the knowledge of the ratio between the expected and actual data points in each lsb bin, one can find the DNL of the transition points for each bin.
$$DNL (LSB) = [AP(nth code) / IP(nth code)] -1$$
AP is the actual number of points in the lsb bin, IP is the ideal number of points. But, in order to trust the result, one needs a certain number of samples in each code bin to have a statistical level of confidence based upon the gaussian distribution of those points.
Using the (gaussian) distribution for each of the bin sample sets, one can use simple sample statistics to find a zscore for the level of confidence of the results. You can use a look up table or use various statistical software to find that value.
For example, if I want a 99% confidence interval and want to find the z-score on the right tail, I can use
qnorm(.005,lower.tail=FALSE) = 2.575829
This means that the z-score needs to be ~2.576 standard deviations away from the mean to get a 99% confidence interval of the statistics (.005 is the right half tail). Recall from basic statistics that 1 standard deviation is about 68% confidence.
As I said, I'm not going to directly prove it here (derivation is in the paper I linked), but in order to accept that the DNL result is less than a certain error and with a minimum statistical level of confidence, one needs a minimum number of samples to do so statistically.
Putting those terms together (without derivation here) we get *
$$NRECORD = π × 2^{N-1} × (Zα/2)² / β² $$
That's the minimum number of records or samples we need to accept our results within a certain confidence interval, and to have our DNL error less than or equal to \$\beta\$.
So suppose we require our DNL test to be based on a N=10 bit converter, and require a DNL error less than or equal to .1 lsb with a 99% confidence interval. This gives us
N_Record_min =pi*2^(10-1)*2.576^2/.1^2= 1067362
or ~1 million samples of the sine wave to run our test.
The same can be applied similarly for INL.
*one possibly (rough) intuitive explanation for the equation is that the standard error of the sampling distribution of the dnl measurements derived from each code bin can be expressed as \$s.e. = \frac{\sigma}{\sqrt{N}}\$. If you want to minimize the standard error of the DNL measurements for a given \$\sigma\$ which is the z-score you calculated for the confidence interval, then you need a certain number of samples per bin, \$N\$, to achieve that. Obviously, the larger the better.
Here are a few other good simplified explanations. In particular, the MAXIM app note shows some examples of poor and misleading DNL results with insufficient number of samples.
https://www.maximintegrated.com/en/design/technical-documents/tutorials/2/2085.html
http://www.atx7006.com/articles/adc_histogram_test