How many Dice Rolls Would It Take to Reach Your Favorite Kind of Number?
By Lucy Martinez and Doron Zeilberger
.pdf
.tex
published in Maple Transactions, Vol. 3 No. 3 (2023).
Inspired by a recent beautiful
paper
[arxiv version] by Noga Alon and Yaakov Malinovsky, we extend it in several directions.
First we consider dice with other number of faces, rather than the usual 6, and second consider what happens if you don't start at 0, but
further on, and third consider many other
properties that a natural number can have, not just that of being a prime.
In the process we show the great power of symbolic computation (i.e. "symbolcrunching") as opposed to mere numerical computation (i.e. "numbercrunching") to
efficiently get both symbolic and numeric output. We conclude with some philosophical remarks that often socalled "rigorous" erroranalysis
as done brilliantly in the AlonMalinowsky paper (that was the inspiration to our paper) is only of theoretical interest, since it
tacitly assumes that we live for ever, that unfortunately we don't.
Written: Jan. 31,2023
Maple packages

HIT1.txt,
a Maple package to simulate and approximate expected time of dice rolls until getting to your favorite kind of numbers, using the AlonMalinovsky approach

HIT2.txt,
a Maple package to simulate and approximate expected time of dice rolls until getting to your favorite kind of numbers, using our generating function approach. It also
gives higher moments.
Sample Input and Output for HIT1.txt

If you want to see estimates for the expected duration of rolling a fair die with N faces (starting at 0 and adding up the outcomes) until reaching a prime,
for N from 2 to 15
the input file
yields the output file

If you want to see estimates for the expected duration of rolling a fair die with N faces (starting at 0 and adding up the outcomes) until reaching a product of two primes,
for N from 2 to 15
the input file
yields the output file

The following file has lists in the form [a_1,a_2,...,a_40],[init=x,f=1..40]
that gives the expectated duration of the primeseeking dierolling game
for dice with ifaces for i=2..40 and with initial value x, but rather than starting at 0,
starting at all the nonprimes ≤ 20
output file
[In other words, for any fixed initial value, it shows how it varies with different number of faces]

The following list of lists in the form [a_1,a_2,...,a_{13}],[init=0..20,f=y]
gives the expectation time number for a prime sum where a_i corresponds to
the expectation time of the dice for fixed number of faces y and initial
values 0..20 such that the initial value is nonprime
output file
[In other words, for any fixed number of faces, it shows how it varies with different starting nonprimes]
Sample Input and Output for HIT2.txt

If you want to see the number of rounds, starting at 0, and adding up the outcomes,
until you are guaranteed to reach a prime with probability
110^{7},
followed by the (conditional on that happening)
for fair dice from 2 faces to 40 faces the
the input file
yields the output file

If you want to see the number of rounds, starting at 0, and adding up the outcomes,
until you are guaranteed to reach a prime with probability
110^{20},
followed by the (conditional on that happening)
for fair dice from 2 faces to 40 faces the
the input file
yields the output file

If you want to see the number of rounds, starting at 0, and adding up the outcomes, until you are guaranteed to reach a PRODUCT OF TWO DISTINCT PRIMES with probability
110^{7},
followed by the (conditional on that happening)
for fair dice from 2 faces to 40 faces the
the input file
yields the output file

If you want to see the number of rounds, starting at 0, and adding up the outcomes, until you are guaranteed to reach a PRODUCT OF THREE DISTINCT PRIMES with probability
110^{7},
followed by the (conditional on that happening)
for fair dice from 2 faces to 40 faces the
the input file
yields the output file

If you want to see the number of rounds, starting at 0, and adding up the outcomes, until you are guaranteed to reach a PRODUCT OF FOUR DISTINCT PRIMES with probability
110^{7},
followed by the (conditional on that happening)
for fair dice from 2 faces to 20 faces the
the input file
yields the output file

If you want to see the number of rounds, STARTING at 2, and adding up the outcomes, until you are guaranteed to reach a PERFECT SQUARE with probability
110^{6},
followed by the (conditional on that happening)
for fair dice from 2 faces to 10 faces the
the input file
yields the output file

If you want to see the number of rounds, STARTING at 2, and adding up the outcomes, until you are guaranteed to reach a PERFECT CUBES with probability
110^{2},
followed by the (conditional on that happening)
for fair dice from 2 faces to 6 faces the
the input file
yields the output file

If you want to see the number of rounds, STARTING at 2, and adding up the outcomes, until you are guaranteed to reach a PERFECT CUBES with probability
110^{3},
followed by the (conditional on that happening)
for fair dice from 2 faces to 5 faces the
the input file
yields the output file
[Note: 6 faces did not make the cutoff!]

Suppose that you are allow up to 200 dicerolls (don't worry, the probability that you won't get a prime is less than 10^{18} in all the cases here),
to see not only the expected duration, but also the expected destination, as well as the correlation (not suprisingly close to 1, but a bit
surprisingly not that close, e.g. for the usual sixfaced fair die it is 0.9656445377, for number of faces from 2 to 20
the input file
yields the output file

If you want to see 102 digits of the AlonMalinovsky constant (a "nonrigorous" estimate, but absolutely certain)
the input file
yields the output file

If you want to see the expected duration, expected destination etc. with the usal fair 6faced die, but
starting at all nonprimes from 1 to 100
the input file
yields the output file

If you want to see the expected duration, expected destination etc. with the usal fair 6faced die, but
starting at all powers of 10 from 10^{0} to 10^{10}:
the input file
yields the output file
If you want to see what happened with a loaded coin where when it is Heads you advance 1, and when it is TAILS you advance 2,
starting at 10^{10},
for Pr(H) from 1/100 to 99/100 (incremented by 1/100)
the input file
yields the output file
If you want to see plots of how, with various starting places, the expected duration changes with the
number of faces with a fair die, see
plot file
Articles of Doron Zeilberger
Doron Zeilberger's Home Page
Lucy Martinez's Home Page