Skip to main content
Specify that coins in the algorithm are fair
Source Link
Peter O.
  • 1.2k
  • 1
  • 9
  • 18

To produce the probability $1/\pi$, the following algorithm can be used (Flajolet et al. 2010), which is based on a series expansion by Ramanujan:

  1. Set $t$ to 0.
  2. Flip two fair coins. If both show heads, add 1 to $t$ and repeat this step. Otherwise, go to step 3.
  3. Flip two fair coins. If both show heads, add 1 to $t$ and repeat this step. Otherwise, go to step 4.
  4. With probability 5/9, add 1 to $t$. (For example, generate a uniform random integer in [1, 9], and if that integer is 5 or less, add 1 to $t$.)
  5. Flip a fair coin $2t$ times, and return 0 if heads showed more often than tails or vice versa. Do this step two more times.
  6. Return 1.

Then, run the algorithm above until you get 1, then let $X$ be the number of runs including the last. Then it holds thatthe expected value of $\mathbb{E}[X] = \pi$$X$ is $\pi$.

Note that the algorithm doesn't involve fractions at all.

See also: https://math.stackexchange.com/questions/4189867/obtaining-irrational-probabilities

REFERENCES:

To produce the probability $1/\pi$, the following algorithm can be used (Flajolet et al. 2010), which is based on a series expansion by Ramanujan:

  1. Set $t$ to 0.
  2. Flip two fair coins. If both show heads, add 1 to $t$ and repeat this step. Otherwise, go to step 3.
  3. Flip two fair coins. If both show heads, add 1 to $t$ and repeat this step. Otherwise, go to step 4.
  4. With probability 5/9, add 1 to $t$. (For example, generate a uniform random integer in [1, 9], and if that integer is 5 or less, add 1 to $t$.)
  5. Flip a fair coin $2t$ times, and return 0 if heads showed more often than tails or vice versa. Do this step two more times.
  6. Return 1.

Then, run the algorithm above until you get 1, then let $X$ be the number of runs including the last. Then it holds that $\mathbb{E}[X] = \pi$.

Note that the algorithm doesn't involve fractions at all.

See also: https://math.stackexchange.com/questions/4189867/obtaining-irrational-probabilities

REFERENCES:

To produce the probability $1/\pi$, the following algorithm can be used (Flajolet et al. 2010), which is based on a series expansion by Ramanujan:

  1. Set $t$ to 0.
  2. Flip two fair coins. If both show heads, add 1 to $t$ and repeat this step. Otherwise, go to step 3.
  3. Flip two fair coins. If both show heads, add 1 to $t$ and repeat this step. Otherwise, go to step 4.
  4. With probability 5/9, add 1 to $t$. (For example, generate a uniform random integer in [1, 9], and if that integer is 5 or less, add 1 to $t$.)
  5. Flip a fair coin $2t$ times, and return 0 if heads showed more often than tails or vice versa. Do this step two more times.
  6. Return 1.

Then, run the algorithm above until you get 1, then let $X$ be the number of runs including the last. Then the expected value of $X$ is $\pi$.

Note that the algorithm doesn't involve fractions at all.

See also: https://math.stackexchange.com/questions/4189867/obtaining-irrational-probabilities

REFERENCES:

Specify that coins in the algorithm are fair
Source Link
Peter O.
  • 1.2k
  • 1
  • 9
  • 18

To produce the probability $1/\pi$, the following algorithm can be used (Flajolet et al. 2010), which is based on a series expansion by Ramanujan:

  1. Set $t$ to 0.
  2. Flip two fair coins. If both show heads, add 1 to $t$ and repeat this step. Otherwise, go to step 3.
  3. Flip two fair coins. If both show heads, add 1 to $t$ and repeat this step. Otherwise, go to step 4.
  4. With probability 5/9, add 1 to $t$. (For example, generate ana uniform random integer in [1, 9], and if that integer is 5 or less, add 1 to $t$.)
  5. Flip a fair coin $2t$ times, and return 0 if heads showed more often than tails or vice versa. Do this step two more times.
  6. Return 1.

Then, run the algorithm above until you get 1, then let $X$ be the number of runs including the last. ThenThen it holds that $\mathbb{E}[X] = \pi$.

Note that the algorithm doesn't involve fractions at all.

See also: https://math.stackexchange.com/questions/4189867/obtaining-irrational-probabilities

REFERENCES:

To produce the probability $1/\pi$, the following algorithm can be used (Flajolet et al. 2010), which is based on a series expansion by Ramanujan:

  1. Set $t$ to 0.
  2. Flip two coins. If both show heads, add 1 to $t$ and repeat this step. Otherwise, go to step 3.
  3. Flip two coins. If both show heads, add 1 to $t$ and repeat this step. Otherwise, go to step 4.
  4. With probability 5/9, add 1 to $t$. (For example, generate an uniform random integer in [1, 9], and if that integer is 5 or less, add 1 to $t$.)
  5. Flip a coin $2t$ times, and return 0 if heads showed more often than tails or vice versa. Do this step two more times.
  6. Return 1.

Then, run the algorithm above until you get 1, then let $X$ be the number of runs including the last. Then it holds that $\mathbb{E}[X] = \pi$.

Note that the algorithm doesn't involve fractions at all.

See also: https://math.stackexchange.com/questions/4189867/obtaining-irrational-probabilities

REFERENCES:

To produce the probability $1/\pi$, the following algorithm can be used (Flajolet et al. 2010), which is based on a series expansion by Ramanujan:

  1. Set $t$ to 0.
  2. Flip two fair coins. If both show heads, add 1 to $t$ and repeat this step. Otherwise, go to step 3.
  3. Flip two fair coins. If both show heads, add 1 to $t$ and repeat this step. Otherwise, go to step 4.
  4. With probability 5/9, add 1 to $t$. (For example, generate a uniform random integer in [1, 9], and if that integer is 5 or less, add 1 to $t$.)
  5. Flip a fair coin $2t$ times, and return 0 if heads showed more often than tails or vice versa. Do this step two more times.
  6. Return 1.

Then, run the algorithm above until you get 1, then let $X$ be the number of runs including the last. Then it holds that $\mathbb{E}[X] = \pi$.

Note that the algorithm doesn't involve fractions at all.

See also: https://math.stackexchange.com/questions/4189867/obtaining-irrational-probabilities

REFERENCES:

Source Link
Peter O.
  • 1.2k
  • 1
  • 9
  • 18

To produce the probability $1/\pi$, the following algorithm can be used (Flajolet et al. 2010), which is based on a series expansion by Ramanujan:

  1. Set $t$ to 0.
  2. Flip two coins. If both show heads, add 1 to $t$ and repeat this step. Otherwise, go to step 3.
  3. Flip two coins. If both show heads, add 1 to $t$ and repeat this step. Otherwise, go to step 4.
  4. With probability 5/9, add 1 to $t$. (For example, generate an uniform random integer in [1, 9], and if that integer is 5 or less, add 1 to $t$.)
  5. Flip a coin $2t$ times, and return 0 if heads showed more often than tails or vice versa. Do this step two more times.
  6. Return 1.

Then, run the algorithm above until you get 1, then let $X$ be the number of runs including the last. Then it holds that $\mathbb{E}[X] = \pi$.

Note that the algorithm doesn't involve fractions at all.

See also: https://math.stackexchange.com/questions/4189867/obtaining-irrational-probabilities

REFERENCES: