Estimating Many Constants With a Coin
By Shalosh B. Ekhad and Doron Zeilberger
.pdf
.tex
First Written: Aug. 20, 2026
This version: Aug. 20, 2026
Exclusively published in the Personal Journal of Shalosh B. Ekhad and Doron Zeilberger and arxiv.com
In this charming note, Jim Propp told us how to estimate π (or rather π/4)
by tossing a fair coin. In another charming article, F. Thomas Bruss and Dvy Paindaveine,
compute many other constants using a loaded coin. Here we generalize it even further, and show the usefulness of
Wilf-Zeilberger algorithmic proof theory.
Maple packages
-
Propp.txt,
a Maple package to compute both exactly and approximate by simulation many interesting constants, by tossing a (usually loaded) coin until,
for the first time, the number of Heads exceeds the number of Tails by d+1, and looking at a function of that score (e.g. the
number of Heads divided by the total number of tosses, but also many others).
-
MultiPropp.txt,
A multi-dimensional extension, computing both exact values and via simulation.
Sample Input and Output for Propp.txt
If you want to see exact values of the expectation of RisingFacorial(#H,r)/RisingFacorial(#Tosses,r) when the number of Heads exceeds the number of Tails for the first time
for r from 1 to 100, where the coin is loaded with Pr(H)=3/4
then the input gives the
output.
If you want to see exact values of the expectation of #H/#Tosses,when the #Heads-#Tails=d+1 for the first time
for d from 1 to 70, where the coin is loaded with Pr(H)=3/4
then the input gives the
output.
Sample Input and Output for MultiPropp.txt
If you want to see exact (well, approximate, by truncating the relevant infinite sums after 200 terms) values of the expectation of x[i]/(x[1]+...+x[k]) when travelling in the k dimensions, Manhattan lattice, starting at the originm
using a fair k-sided die until you get, for the first time out of
x[1] ≥ x[2] ≥ ... ≥ x[k] ≥ 0
followed by estimates obtained by simulation (using 3000 trials, and averaging) for k from 2 to 5 and i from 1 to k,
then the input gives the
output.
Personal Journal of Shalosh B. Ekhad and Doron Zeilberger
Doron Zeilberger's Home Page