This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Hitting kk primes by dice rolls

Noga Alon Department of Mathematics, Princeton University, Princeton, NJ 08544. [email protected] Yaakov Malinovsky Department of Mathematics and Statistics, University of Maryland, Baltimore County, Baltimore, MD 21250 [email protected] Lucy Martinez Department of Mathematics, Rutgers University, Piscataway, NJ 08854 [email protected]  and  Doron Zeilberger Department of Mathematics, Rutgers University, Piscataway, NJ 08854 [email protected]
Abstract.

Let S=(d1,d2,d3,)S=(d_{1},d_{2},d_{3},\ldots) be an infinite sequence of rolls of independent fair dice. For an integer k1k\geq 1, let Lk=Lk(S)L_{k}=L_{k}(S) be the smallest ii so that there are kk integers jij\leq i for which t=1jdt\sum_{t=1}^{j}d_{t} is a prime. Therefore, LkL_{k} is the random variable whose value is the number of dice rolls required until the accumulated sum equals a prime kk times. It is known that the expected value of L1L_{1} is close to 2.432.43. Here we show that for large kk, the expected value of LkL_{k} is (1+o(1))klogek(1+o(1))k\log_{e}k, where the o(1)o(1)-term tends to zero as kk tends to infinity. We also include some computational results about the distribution of LkL_{k} for k100k\leq 100.

Keywords: characteristic polynomial, Chernoff inequality, combinatorial probability, hitting time, Prime Number Theorem.

MSC2020 subject classifications: 60C05, 11A41, 60G40.

1. Results

Let S=(d1,d2,d3,)S=(d_{1},d_{2},d_{3},\ldots) be an infinite sequence of rolls of independent fair dice. Thus the did_{i} are independent, identically distributed random variables, each uniformly distributed on the integers {1,2,,6}\{1,2,\ldots,6\}. For each i1i\geq 1 put si=j=1idjs_{i}=\sum_{j=1}^{i}d_{j}. The sequence SS hits a positive integer xx if there exists an ii so that si=xs_{i}=x. In that case it hits xx in step ii.

For any positive integer kk, let Lk=Lk(S)L_{k}=L_{k}(S) be the random variable whose value is the smallest ii so that the sequence SS hits kk primes during the first ii steps (\infty if there is no such ii, but it is easy to see that with probability 11 there is such ii). The random variable L1L_{1} is introduced and studied in [1], see also [4], [3] for several variants and generalizations.

Here we consider the random variable LkL_{k} for larger values of kk, focusing on the estimate of its expectation.

1.1. Computational results

This article is accompanied by a Maple package PRIMESk, available from

https://sites.math.rutgers.edu/~zeilberg/mamarim/mamarimhtml/primesk.html  ,

where there are also numerous output files.

Using our Maple package, we computed the following values of the expectation of LkL_{k} for k30k\leq 30.

kk E(Lk)E(L_{k}) kk E(Lk)E(L_{k}) kk E(Lk)E(L_{k})
11 2.4284979142.428497914 1111 48.1432055548.14320555 2121 106.3962997106.3962997
22 5.7122404685.712240468 1212 53.6135145953.61351459 2222 112.5650207112.5650207
33 9.4988781199.498878119 1313 59.1640665559.16406655 2323 118.7684092118.7684092
44 13.6505927113.65059271 1414 64.7933735064.79337350 2424 125.0081994125.0081994
55 18.0540893118.05408931 1515 70.5051712770.50517127 2525 131.2881683131.2881683
66 22.6461540222.64615402 1616 76.3028416176.30284161 2626 137.6114097137.6114097
77 27.4211590227.42115902 1717 82.1856621382.18566213 2727 143.9783110143.9783110
88 32.3775285232.37752852 1818 88.1475762688.14757626 2828 150.3859881150.3859881
99 37.5002990337.50029903 1919 94.1781125694.17811256 2929 156.8292462156.8292462
1010 42.7647186842.76471868 2020 100.2648068100.2648068 3030 163.3025173163.3025173

The table suggests that the asymptotic value of this expectation is (1+o(1))klogk(1+o(1))k\log k, where the o(1)o(1)-term tends to zero as kk tends to infinity, and the logarithm here and throughout the manuscript is in the natural basis. This is confirmed in the results stated in the next subsection and proved in Section 2.

The value of the standard deviation of LkL_{k} for k30k\leq 30 is given in the following table.

kk Std(Lk)Std(L_{k}) kk Std(Lk)Std(L_{k}) kk Std(Lk)Std(L_{k})
11 2.49855532.4985553 1111 14.918414714.9184147 2121 23.387307023.3873070
22 4.23939794.2393979 1212 15.818543515.8185435 2222 24.081633924.0816339
33 5.76790765.7679076 1313 16.710984016.7109840 2323 24.776998124.7769981
44 7.11853917.1185391 1414 17.611557417.6115574 2424 25.482183425.4821834
55 8.35987848.3598784 1515 18.519767818.5197678 2525 26.195216626.1952166
66 9.57155719.5715571 1616 19.422732419.4227324 2626 26.905543026.9055430
77 10.761804610.7618046 1717 20.302274820.3022748 2727 27.599719527.5997195
88 11.906243811.9062438 1818 21.141969721.1419697 2828 28.267848228.2678482
99 12.982459612.9824596 1919 21.932924021.9329240 2929 28.908071928.9080719
1010 13.982335913.9823359 2020 22.677184622.6771846 3030 29.527602129.5276021

The value of the skewness of LkL_{k} for k30k\leq 30 is given in the following table.

kk Skew(Lk)Skew(L_{k}) kk Skew(Lk)Skew(L_{k}) kk Skew(Lk)Skew(L_{k})
11 3.39042473.3904247 1111 0.75694280.7569428 2121 0.52051730.5205173
22 2.14964682.1496468 1212 0.73622630.7362263 2222 0.51482840.5148284
33 1.64207711.6420771 1313 0.72507160.7250716 2323 0.51344090.5134409
44 1.38927781.3892778 1414 0.71313870.7131387 2424 0.51080480.5108048
55 1.25540761.2554076 1515 0.69392890.6939289 2525 0.50290530.5029053
66 1.15035021.1503502 1616 0.66573440.6657344 2626 0.48883190.4888319
77 1.04746281.0474628 1717 0.63073740.6307374 2727 0.47078410.4707841
88 0.94877030.9487703 1818 0.59365500.5936550 2828 0.45281980.4528198
99 0.86252270.8625227 1919 0.56018120.5601812 2929 0.43911450.4391145
1010 0.79744960.7974496 2020 0.53510980.5351098 3030 0.43242040.4324204

The value of the kurtosis of LkL_{k} for k30k\leq 30 is given in the following table.

kk Ku(Lk)Ku(L_{k}) kk Ku(Lk)Ku(L_{k}) kk Ku(Lk)Ku(L_{k})
11 20.621448520.6214485 1111 3.96304893.9630489 2121 3.45535143.4553514
22 10.047545210.0475452 1212 3.94278963.9427896 2222 3.46751493.4675149
33 7.20989047.2098904 1313 3.90318033.9031803 2323 3.45663693.4566369
44 6.10448286.1044828 1414 3.83084313.8308431 2424 3.41994353.4199435
55 5.50853805.5085380 1515 3.73142413.7314241 2525 3.36795993.3679599
66 5.02734415.0273441 1616 3.62236953.6223695 2626 3.31833503.3183350
77 4.61516974.6151697 1717 3.52544833.5254483 2727 3.28736773.2873677
88 4.29937634.2993763 1818 3.45908693.4590869 2828 3.28354813.2835481
99 4.09788904.0978890 1919 3.43128233.4312823 2929 3.30511863.3051186
1010 3.99892753.9989275 2020 3.43598833.4359883 3030 3.34149883.3414988

We end this section with some figures and a table of the scaled probability density functions for the number of rolls of a fair die until visiting the primes kk times for various kk values. (Recall that the scaled version of a random variable XX with expectation μ\mu and variance σ2\sigma^{2} is (Xμ)/σ(X-\mu)/\sigma).

kk Expectation Standard Deviation Skewness Kurtosis
2020 100.2648068100.2648068 22.677184622.6771846 0.53510980.5351098 3.43598833.4359883
4040 229.8903783229.8903783 36.127190236.1271902 0.37779490.3777949 3.12785263.1278526
6060 370.5241578370.5241578 46.024513546.0245135 0.14067630.1406763 2.61645072.6164507
8080 520.2899340520.2899340 57.815236057.8152360 0.29105800.2910580 2.97075152.9707515
100100 676.3153763676.3153763 65.276593365.2765933 0.22304110.2230411 3.07043083.0704308
Refer to caption
k=20k=20
Refer to caption
k=40k=40
Refer to caption
k=60k=60
Refer to caption
k=80k=80
Refer to caption
k=100k=100
Figure 1. Scaled probability density function for the number of rolls of a fair die until visiting the primes kk times.

Based on the available data above, the argument described in the next section, and the known results about the function π(n)\pi(n) which is the number of primes that do not exceed nn, a possible guess for a more precise expression for E(Lk)E(L_{k}) may be k(logk+loglogk+c1)+c2k(\log k+\log\log k+c_{1})+c_{2}. This is also roughly consistent with the computational evidence.

1.2. Asymptotic results

In the next section we prove the following two results.

Theorem 1.1.

For any fixed positive reals ε,δ\varepsilon,\delta there exists k0=k0(ε,δ)k_{0}=k_{0}(\varepsilon,\delta) so that for all k>k0k>k_{0} the probability that |Lkklogk|>εklogk|L_{k}-k\log k|>\varepsilon k\log k is smaller than δ\delta.

Theorem 1.2.

For any fixed ε>0\varepsilon>0 and any k>k0(ε)k>k_{0}(\varepsilon), the expected value of the random variable LkL_{k} satisfies |E(Lk)klogk|<εklogk|E(L_{k})-k\log k|<\varepsilon k\log k.

2. Proofs

In all proofs we omit all floor and ceiling signs whenever these are not crucial, in order to simplify the presentation.

Lemma 2.1.

There are fixed positive CC and μ, 0<μ<1\mu,\,0<\mu<1 so that the following holds. Let S=(d1,d2,)S=(d_{1},d_{2},\ldots) be a random sequence of independent rolls of fair dice. For any positive integer xx, let p(x)p(x) denote the probability that SS hits xx. Then |p(x)2/7|C(1μ)x|p(x)-2/7|\leq C(1-\mu)^{x}, that is, as xx grows, p(x)p(x) converges to the constant 2/72/7 with an exponential rate.

Proof.

Define p(5)=p(4)=p(3)=p(2)=p(1)=0p(-5)=p(-4)=p(-3)=p(-2)=p(-1)=0, p(0)=1p(0)=1 and note that for every i1i\geq 1,

p(i)=16j=16p(ij).p(i)=\frac{1}{6}\sum_{j=1}^{6}p(i-j).

Indeed, SS hits ii if and only if the last number it hits before ii is iji-j for some j{1,,6}j\in\{1,\ldots,6\}, and the die rolled after that gives the value jj. The probability of this event for each specific value of jj is p(ij)(1/6)p(i-j)\cdot(1/6), providing the equation above. (Note that the definition of the initial values is consistent with this reasoning, as before any dice rolls the initial sum is 0). Thus, the sequence (p(i))(p(i)) satisfies the homogeneous linear recurrence relation given above. The characteristic polynomial of that is

P(z)=z616(z5+z4+z3+z2+z+1).P(z)=z^{6}-\frac{1}{6}(z^{5}+z^{4}+z^{3}+z^{2}+z+1).

One of the roots of this polynomial is z=1z=1, and its multiplicity is 11 as the derivative of P(z)P(z) does not vanish at 11. It is also easy to check that the absolute value of each of the other roots λj\lambda_{j}, 2j62\leq j\leq 6 of P(z)P(z) is at most 1μ1-\mu for some absolute positive constant μ, 0<μ<1\mu,\,0<\mu<1. Therefore, there are constants cjc_{j} so that

p(i)=c11i+j=26cjλji,p(i)=c_{1}\cdot 1^{i}+\sum_{j=2}^{6}c_{j}\lambda_{j}^{i},

implying that

|p(i)c1|C(1μ)i|p(i)-c_{1}|\leq C(1-\mu)^{i}

for some absolute constant CC. It remains to compute the value of c1c_{1}. By the last estimate, for any positive nn,

|i=1np(i)c1n|C/(1μ).|\sum_{i=1}^{n}p(i)-c_{1}n|\leq C/(1-\mu).

Note that the sum i=1np(i)\sum_{i=1}^{n}p(i) is the expected number of integers in [n]={1,2,,n}[n]=\{1,2,\ldots,n\} hit by the sequence SS.

For each fixed ff, d1+d2++dfd_{1}+d_{2}+\cdots+d_{f} is a sum of ff independent identically distributed random variables, each uniform on {1,2,,6}\left\{1,2,\ldots,6\right\}. By the standard estimates for the distribution of sums of independent bounded random variables, see., e.g., [2], Theorem A.1.16, this sum is very close to 7f/27f/2 with high probability. Therefore for large nn the expectation considered above is (1+o(1))(2/7)n(1+o(1))(2/7)n. Dividing by nn and taking the limit as nn tends to infinity shows that c1=2/7c_{1}=2/7, completing the proof. ∎

Note that the lemma above implies that there exists an absolute positive constant cc so that for any (large) integer gg the following holds:

(1) For anyxclogg5,p(x)=27eε1(x),1p(x)=57eε2(x)where|ε1(x)|<1/g,|ε2(x)|1/g.\mbox{For any}~{}~{}x\geq c\log g-5,~{}~{}p(x)=\frac{2}{7}e^{\varepsilon_{1}(x)},1-p(x)=\frac{5}{7}e^{\varepsilon_{2}(x)}~{}~{}\mbox{where}~{}~{}|\varepsilon_{1}(x)|<1/g,|\varepsilon_{2}(x)|\leq 1/g.

It will be convenient to apply this estimate later.

Let Ym(S)Y_{m}(S) denote the number of primes in [m]={1,2,,m}[m]=\{1,2,\ldots,m\} hit by SS. In the next lemma we use the letters HH and NN to represent ”hit” and ”not-hit”, respectively.

Lemma 2.2.

For any sequence of integers 1x1<x2<<xg1\leq x_{1}<x_{2}<\cdots<x_{g} that satisfy x1cloggx_{1}\geq c\log g and xi+1xicloggx_{i+1}-x_{i}\geq c\log g for all 1ig11\leq i\leq g-1, where cc is the constant from (1), and for every ν{H,N}g\nu\in\left\{H,N\right\}^{g} the following holds. Let hh be the number of HH coordinates of ν\nu. Then,

P(Shitsxiiffνi=H)=(27)h(57)gheε(ν),\displaystyle P\left(S\,\,\,\text{hits}\,\,\,x_{i}\,\,\,\text{iff}\,\,\,\nu_{i}=H\right)=\left(\frac{2}{7}\right)^{h}\left(\frac{5}{7}\right)^{g-h}e^{\varepsilon(\nu)},

where |ε(ν)|1.|\varepsilon(\nu)|\leq 1.

Proof.

The probability of the event (Shitsxiiffνi=H)\left(S\,\,\,\text{hits}\,\,\,x_{i}\,\,\,\text{iff}\,\,\,\nu_{i}=H\right) is a product of gg terms. The first term is the probability that SS hits x1x_{1} (if ν1=H\nu_{1}=H) or the probability that SS does not hit x1x_{1} (if ν1=N\nu_{1}=N). Note that since x1>cloggx_{1}>c\log g this probability is 27eε1\frac{2}{7}e^{\varepsilon_{1}} in the first case and 57eε2\frac{5}{7}e^{\varepsilon_{2}} in the second case, where both |ε1||\varepsilon_{1}| and |ε2||\varepsilon_{2}| are at most 1/g1/g.

The second term in the product is the conditional probability that SS hits x2x_{2} (if ν2=H\nu_{2}=H), or that it does not hit x2x_{2} (if ν2=N\nu_{2}=N), given the first value it hit in the interval x1,x1+1,,x1+5x_{1},x_{1}+1,\ldots,x_{1}+5. If ν1=H\nu_{1}=H, this first value is x1x_{1} itself, and then the probability to hit x2x_{2} is exactly p(x2x1)p(x_{2}-x_{1}). If ν1=N\nu_{1}=N, then this first value is one of the 55 possibilities x1+jx_{1}+j for some 1j51\leq j\leq 5. Subject to hitting x1+jx_{1}+j, the conditional probability to hit x2x_{2} is exactly p(x2x1j)p(x_{2}-x_{1}-j), which by the assumption on the difference x2x1x_{2}-x_{1}, is very close to 27\frac{2}{7}. By the law of total probability it follows that in any case the conditional probability to hit x2x_{2} is 27eε\frac{2}{7}e^{\varepsilon^{\prime}} and the conditional probability not to hit it is 57eε"\frac{5}{7}e^{\varepsilon"} where the absolute value of ε\varepsilon^{\prime} and of ε"\varepsilon" is at most 1/g1/g. Continuing in this manner we get a product of gg terms, hh of which are very close to 2/72/7 and ghg-h are very close to 5/75/7, where the product of all error terms eε′′′e^{\varepsilon^{\prime\prime\prime}} is of the form eεe^{\varepsilon} for some |ε|g(1/g)=1|\varepsilon|\leq g\cdot(1/g)=1. This completes the proof of the lemma. ∎

Proposition 2.3.

For any sequence x1<x2<<xnx_{1}<x_{2}<\cdots<x_{n} of positive integers and any anlog(n)a\geq\sqrt{n}\log(n)

P(|#xihit27n|a)eca2nlog(n),\displaystyle P\left(\Big{|}\#x_{i}\,\,\,\,\text{hit}\,\,\,-\frac{2}{7}n\Big{|}\geq a\right)\leq e^{-c^{\prime}\frac{a^{2}}{n\log(n)}},

for some absolute positive constant cc^{\prime}.

Proof.

Split x1,,xnx_{1},\ldots,x_{n} into clog(n)c\log(n) subsequences, where subsequence number jj consists of all xix_{i} with index ijmod(clogn)i\equiv j~{}\mbox{mod}~{}(c\log n) where cc is the constant from (1). Note that the difference between any two distinct elements in the same subsequences is at least clognc\log n and that each of these subsequences can contain at most one element smaller than clognc\log n. Each one of the subsequences contains r:=nclog(n)r:=\frac{n}{c\log(n)} elements xix_{i}. In each subsequence, the probability to deviate in absolute value from 27r\frac{2}{7}r hits by more than aclog(n)\frac{a}{c\log(n)} can be bounded by the Chernoff’s bound for binomial distributions, up to a factor of ee. Indeed, Lemma 2.2 shows that the contribution of each term does not exceed the contribution of the corresponding term for the binomial random variable with parameters rr and 2/72/7 by more than a factor of ee. Note that although each subsequence may contain one element smaller than clognc\log n, the contribution of this single element to the deviation is negligible and can be ignored. Plugging in the standard bound, see, e.g. [2], Theorem A.1.16, we get that the probability of the event considered is at most

2eec(aclog(n))2/(nclog(n))ec′′a2nlog(n)2e\cdot e^{-c^{\prime}\left(\frac{a}{c\log(n)}\right)^{2}/\left(\frac{n}{c\log(n)}\right)}\leq e^{-c^{\prime\prime}\frac{a^{2}}{n\log(n)}}

for appropriate absolute constants cc^{\prime}, c′′c^{\prime\prime}. Here we used the fact that since aa is large the constant 2e2e can be swallowed by the choice of c′′c^{\prime\prime}. Therefore, the probability to deviate in at least one of the subsequences by more than a/(clogn)a/(c\log n) is at most

clog(n)ec′′a2nlog(n)ec′′′a2nlog(n),c\log(n)e^{-c^{\prime\prime}\frac{a^{2}}{n\log(n)}}\leq e^{-c^{\prime\prime\prime}\frac{a^{2}}{n\log(n)}},

where in the last inequality we used again the fact that anlog(n)a\geq\sqrt{n}\log(n). ∎

Recall that LkL_{k} is the minimum ii so that SS hits kk primes in the first ii steps.

Corollary 2.4.

(1) If 27π(m1)ka\frac{2}{7}\pi(m_{1})\leq k-a and aπ(m1)log(π(m1))a\geq\sqrt{\pi(m_{1})}\log(\pi(m_{1})), then

P(Ym1k)ec′′′a2π(m1)log(π(m1)).\displaystyle P\left(Y_{m_{1}}\geq k\right)\leq e^{-c^{\prime\prime\prime}\frac{a^{2}}{\pi(m_{1})\log(\pi(m_{1}))}}.

(2) If 27π(m2)k+a\frac{2}{7}\pi(m_{2})\geq k+a and aπ(m2)log(π(m2))a\geq\sqrt{\pi(m_{2})}\log(\pi(m_{2})) then

P(Ym2k)ec′′′a2π(m2)log(π(m2)).\displaystyle P\left(Y_{m_{2}}\leq k\right)\leq e^{-c^{\prime\prime\prime}\frac{a^{2}}{\pi(m_{2})\log(\pi(m_{2}))}}.
Proof.

(1) The event {Ym1k}{\displaystyle\left\{Y_{m_{1}}\geq k\right\}} means that the number of primes that are at most m1m_{1} and are hit by the infinite sequence of the initial sums of dice rolls is a least kk. Therefore, if 27π(m1)ka\frac{2}{7}\pi(m_{1})\leq k-a, we have

P(Ym1k)=P(Ym127π(m1)k27π(m1))P(|Ym127π(m1)|a)ec′′′a2π(m1)log(π(m1)),\displaystyle P\left(Y_{m_{1}}\geq k\right)=P\left(Y_{m_{1}}-\frac{2}{7}\pi(m_{1})\geq k-\frac{2}{7}\pi(m_{1})\right)\leq P\left(\Big{|}Y_{m_{1}}-\frac{2}{7}\pi(m_{1})\Big{|}\geq a\right)\leq e^{-c^{\prime\prime\prime}\frac{a^{2}}{\pi(m_{1})\log(\pi(m_{1}))}},

where the last inequality follows from Proposition 2.3.

(2) Similarly, if 27π(m2)k+a\frac{2}{7}\pi(m_{2})\geq k+a, we have

P(Ym2k)=P(Ym227π(m2)k27π(m2))P(Ym227π(m2)a)\displaystyle P\left(Y_{m_{2}}\leq k\right)=P\left(Y_{m_{2}}-\frac{2}{7}\pi(m_{2})\leq k-\frac{2}{7}\pi(m_{2})\right)\leq P\left(Y_{m_{2}}-\frac{2}{7}\pi(m_{2})\leq-a\right)
P(|Ym227π(m2)|a)ec′′′a2π(m2)log(π(m2)),\displaystyle\leq P\left(\Big{|}Y_{m_{2}}-\frac{2}{7}\pi(m_{2})\Big{|}\geq a\right)\leq e^{-c^{\prime\prime\prime}\frac{a^{2}}{\pi(m_{2})\log(\pi(m_{2}))}},

where the last inequality follows from Proposition 2.3. ∎

Corollary 2.5.

(1) For a given (large) kk, let m1m_{1} be the smallest integer so that

π(m1)=72(k2klogk.\pi(m_{1})=\lfloor\frac{7}{2}(k-2\sqrt{k}\log k\rfloor.

Then for any ii satisfying 72im1a\frac{7}{2}i\leq m_{1}-a, where a2klog(k)a\geq 2\sqrt{k}\log(k),

P(Lki)P(d1++dim1)+P(Ym1k)ec′′′′a2i+ec′′′klog2kπ(m1)log(π(m1))kα\displaystyle P\left(L_{k}\leq i\right)\leq P\left(d_{1}+\cdots+d_{i}\geq m_{1}\right)+P\left(Y_{m_{1}}\geq k\right)\leq e^{-c^{\prime\prime\prime\prime}\frac{a^{2}}{i}}+e^{-c^{\prime\prime\prime}\frac{k\log^{2}k}{\pi(m_{1})\log(\pi(m_{1}))}}\leq k^{-\alpha}

for some absolute constant α>0\alpha>0.

(2) For a given (large) kk and for aklog2ka\geq\sqrt{k}\log^{2}k let m2m_{2} be the smallest integer so that

π(m2)=72(k+a).\pi(m_{2})=\lceil\frac{7}{2}(k+a)\rceil.

Then for any ii satisfying 72im2+b\frac{7}{2}i\geq m_{2}+b, where bab\geq a

P(Lki)P(d1++dim2)+P(Ym2k)ec′′′′b2i+ec′′′a2π(m2)log(π(m2)).\displaystyle P\left(L_{k}\geq i\right)\leq P\left(d_{1}+\cdots+d_{i}\leq m_{2}\right)+P\left(Y_{m_{2}}\leq k\right)\leq e^{-c^{\prime\prime\prime\prime}\frac{b^{2}}{i}}+e^{-c^{\prime\prime\prime}\frac{a^{2}}{\pi(m_{2})\log(\pi(m_{2}))}}.
Proof.

(1) If both events {d1++dim1}{\displaystyle\left\{d_{1}+\cdots+d_{i}\geq m_{1}\right\}} and {Ym1k}{\displaystyle\left\{Y_{m_{1}}\geq k\right\}} do not occur, then the event {Lki}{\displaystyle\left\{L_{k}\leq i\right\}} does not occur. Therefore, for 72im1a\frac{7}{2}i\leq m_{1}-a we have

P(Lki)P(d1++dim1)+P(Ym1k)P(d1++di72ia)+P(Ym1k)\displaystyle P\left(L_{k}\leq i\right)\leq P\left(d_{1}+\cdots+d_{i}\geq m_{1}\right)+P\left(Y_{m_{1}}\geq k\right)\leq P\left(d_{1}+\cdots+d_{i}-\frac{7}{2}i\geq a\right)+P\left(Y_{m_{1}}\geq k\right)
ec′′′′a2i+ec′′′klog2kπ(m1)log(π(m1)),\displaystyle\leq e^{-c^{\prime\prime\prime\prime}\frac{a^{2}}{i}}+e^{-c^{\prime\prime\prime}\frac{k\log^{2}k}{\pi(m_{1})\log(\pi(m_{1}))}},

where the last inequality follows from Chernoff’s bound and the first part of Corollary 2.4. Note that here 2klogkπ(m1)log(π(m1))2\sqrt{k}\log k\geq\sqrt{\pi(m_{1})}\log(\pi(m_{1})) and therefore the corollary can be applied.

(2) Similarly, if both events {d1++dim2}{\displaystyle\left\{d_{1}+\cdots+d_{i}\leq m_{2}\right\}} and {Ym2k}{\displaystyle\left\{Y_{m_{2}}\leq k\right\}} do not occur, then the event {Lk>i}{\displaystyle\left\{L_{k}>i\right\}} does not occur. Therefore, for 72im2+b\frac{7}{2}i\geq m_{2}+b, we have

P(Lki)P(d1++di72ib)+P(Ym2k)ec′′′′b2i+ec′′′a2π(m2)log(π(m2)),\displaystyle P\left(L_{k}\geq i\right)\leq P\left(d_{1}+\cdots+d_{i}-\frac{7}{2}i\leq-b\right)+P\left(Y_{m_{2}}\leq k\right)\leq e^{-c^{\prime\prime\prime\prime}\frac{b^{2}}{i}}+e^{-c^{\prime\prime\prime}\frac{a^{2}}{\pi(m_{2})\log(\pi(m_{2}))}},

where the last inequality follows again from Chernoff’s bound and the second part of Corollary 2.4. Indeed the corollary can be applied since it is not difficult to check that for large kk and any aklog2ka\geq\sqrt{k}\log^{2}k,

aπ(m2)log(π(m2))=72(k+a)log(72(k+a)).a\geq\sqrt{\pi(m_{2})}\log(\pi(m_{2}))=\sqrt{\lceil\frac{7}{2}(k+a)\rceil}\log(\lceil\frac{7}{2}(k+a)\rceil).


Proof of Theorem 1.1:  Note that by the Prime Number Theorem in the first part of Corollary 2.5,

m1=(72+o(1))klogk.m_{1}=(\frac{7}{2}+o(1))k\log k.

Taking a=2klogka=2\sqrt{k}\log k and letting i1i_{1} be the largest integer so that 72im1a\frac{7}{2}i\leq m_{1}-a it follows from this first part that i1=(1+o(1))klogki_{1}=(1+o(1))k\log k and that the probability that LkL_{k} is smaller than i1i_{1} is smaller than some negative power of kk, that is, tends to 0 as kk tends to infinity.

Similarly, substituting in the second part of the corollary a=b=klog2ka=b=\sqrt{k}\log^{2}k and letting i2i_{2} be the smallest integer so that 72im2+a\frac{7}{2}i\geq m_{2}+a it is easy to see that i2i_{2} is also (1+o(1))klogk(1+o(1))k\log k (since

m2=(72+o(1))klogk,m_{2}=(\frac{7}{2}+o(1))k\log k,

by the Prime Number Theorem). By the second part of the corollary the probability that LkL_{k} is larger than i2i_{2} is smaller than any fixed negative power of kk, and hence tends to 0 as kk tends to infinity. Therefore LkL_{k} is (1+o(1))klogk(1+o(1))k\log k with probability tending to 11 as kk tends to infinity, completing the proof of the theorem. \Box

Proof of Theorem 1.2:  The expectation of LkL_{k} is the sum over all positive integers ii, of the probabilities P(Lki)P(L_{k}\geq i). Taking a=klog2ka=\sqrt{k}\log^{2}k and defining m1m_{1} and m2m_{2} as before we break this sum into three parts,

S1=i:72im1aP(Lki),S_{1}=\sum_{i:\frac{7}{2}i\leq m_{1}-a}P\left(L_{k}\geq i\right),
S2=i:72im2+aP(Lki),S_{2}=\sum_{i:\frac{7}{2}i\geq m_{2}+a}P\left(L_{k}\geq i\right),

and

S3=i:m1a<72i<m2+aP(Lki).S_{3}=\sum_{i:m_{1}-a<\frac{7}{2}i<m_{2}+a}P\left(L_{k}\geq i\right).

By the first part of Corollary 2.5 each summand in the first sum S1S_{1} is 1o(1)1-o(1) and therefore S1=(1+o(1))klogkS_{1}=(1+o(1))k\log k, as the number of summands is (1+o(1))klogk(1+o(1))k\log k, since m1=(72+o(1))klogk.m_{1}=(\frac{7}{2}+o(1))k\log k. By the second part of the corollary (applied to an appropriately chosen sequence of a,m2a,m_{2} and bb) it is not difficult to check that the infinite sum S2S_{2} is only o(1)o(1). Indeed, it is possible, for example, to choose a0=klog2ka_{0}=\sqrt{k}\log^{2}k and aj=jka_{j}=jk for all j1j\geq 1. The corresponding value m2,jm_{2,j} of m2m_{2} for each aja_{j} is defined as the smallest integer satisfying π(m2,j)=72(k+aj)\pi(m_{2,j})=\lceil\frac{7}{2}(k+a_{j})\rceil. Taking bj=ajb_{j}=a_{j} we can apply the estimate in the second part of the corollary to all values of ii satisfying m2,j+aj72i<m2,j+1+aj+1m_{2,j}+a_{j}\leq\frac{7}{2}i<m_{2,j+1}+a_{j+1}. The sum of the probabilities P(Lki)P(L_{k}\geq i) for these values of ii is thus at most keΩ(log3k)ke^{-\Omega(\log^{3}k)} for j=0j=0, and at most keΩ(jk/log(jk))ke^{-\Omega(jk/\log(jk))} for each j1j\geq 1. The sum of all these quantities is smaller than any fixed negative power of kk, and is therefore o(1)o(1), as needed.

The sum S3S_{3} is a sum of at most m2m1+2am_{2}-m_{1}+2a terms, and each of them is at most 11, implying that 0S3m2m1+2a=o(klogk)0\leq S_{3}\leq m_{2}-m_{1}+2a=o(k\log k), since both m1m_{1} and m2m_{2} are (72+o(1))klogk(\frac{7}{2}+o(1))k\log k, and 2a=O(klog2k)2a=O(\sqrt{k}\log^{2}k). This completes the proof of the theorem. \Box

3. Concluding remarks and extensions

  • Extensions for biased rr-sided dice and arbitrary subsets of the integers. The proofs in the previous section use very little of the specific properties of the primes and the specific distribution of each did_{i}. It is easy to extend the result to any rr-sided dice with an arbitrary discrete distribution on [r][r] in which the values obtained with positive probabilities do not have any nontrivial common divisor. The constants 3.53.5 and 2/72/7 will then have to be replaced by the expectation of the random variable did_{i} and by its reciprocal, respectively. It is interesting to note that while for different dice the expectation of LkL_{k} for small values of kk can be very different from the corresponding expectation for a standard fair die, once the die is fixed, for large kk the expectation is always (1+o(1))klogk(1+o(1))k\log k, where the o(1)o(1)-term tends to 0 as kk tends to infinity.

    It is also possible to replace the primes by an arbitrary subset TT of the positive integers, and repeat the arguments to analyze the corresponding random variable for this case, replacing the Prime Number Theorem by the counting function of TT. We omit the details.

  • Heuristic suggestion for a more precise expression for E(Lk)E(L_{k}). If we substitute for π(n)\pi(n) its approximation n/lognn/\log n and repeat the analysis described here with this approximation, the more precise value for the expectation E(Lk)E(L_{k}) that follows is k(logk+loglogk+O(1))k(\log k+\log\log k+O(1)). Since at the beginning there are some fluctuations, we tried to add another constant and consider an expression of the form k(logk+loglogk+c1)+c2k(\log k+\log\log k+c_{1})+c_{2}. Choosing c1c_{1} and c2c_{2} that provide the best fit for our (limited and therefore maybe overfitted) computational evidence we obtained the heuristic expression f(k)=k(logk+loglogk+0.543)+8.953.f(k)=k(\log k+\log\log k+0.543)+8.953. For the record, here are the ratios of E[Lk]/f(k)E[L_{k}]/f(k) for k=20,40,60,80,100k=20,40,60,80,100, respectively:

    0.9861651120,0.9976101939,0.9966486957,0.998338113,0.99974485120.9861651120,0.9976101939,0.9966486957,0.998338113,0.9997448512.

    One can also replace n/lognn/\log n by the more precise approximation Li(n)Li(n) for π(n)\pi(n), but the difference between these two estimates does not change the expression obtained for E(Lk)E(L_{k}) in a significant way.

Acknowledgment Noga Alon is supported in part by NSF grant DMS-2154082. Yaakov Malinovsky is supported in part by BSF grant 2020063. Lucy Martinez is supported by the NSF Graduate Research Fellowship Program under Grant No. 2233066. YM expresses gratitude to Stanislav Molchanov for suggesting that the hits on squares asymptotically follow a success probability of 1/3.51/3.5.

References

  • [1] Noga Alon and Yaakov Malinovsky, Hitting a prime in 2.43 dice rolls (on average), The American Statistician, Volume 77 (2023), no. 3, 301-303. https://arxiv.org/abs/2209.07698
  • [2] Noga Alon and Joel H. Spencer, The Probabilistic Method, Fourth Edition, Wiley, 2016, xiv+375 pp.
  • [3] Shane Chern, Hitting a prime by rolling a die with infinitely many faces, The American Statistician, Volume 78 (2024), no. 3, 297-303. https://arxiv.org/abs/2306.14073
  • [4] Lucy Martinez and Doron Zeilberger, How many dice rolls would it take to reach your favorite kind of number?, Maple Transactions, Volume 3 (2023), no. 3, Article 15953. https://mapletransactions.org/index.php/maple/article/view/15953