3
$\begingroup$

Consider a six-sided die with numbers from $1$ to $6$. Imagine you have a jar with $99$ of such dice. You throw all dice on the floor randomly. You look at one of the dice on the floor at a time. For each die, you do the following:

  • If it landed at an even number $(2,4,6)$, you turn the die so that it lands on the number $1$.

  • If the die landed on an odd number $(1,3,5)$, you throw the die up in the air, so it can land on any number.

After you finish doing the above for all dice on the floor, you come back to the first die and repeat the entire process again. You keep on doing this until eternity (for a billion years, let’s say). If I come into the room after a billion years, how many dice on the floor will have even numbers up?

$\endgroup$
6
  • 1
    $\begingroup$ Hi, welcome to Mathematica.SE, please consider taking the tour so you learn the basic rules of the site. Your question may be put on-hold because it seems to be off-topic, i.e its about mathematics and not Mathematica. If that's not your intention, please edit your question to make it explicitly about Mathematica programming. Include a minimum example of the code you are working on. $\endgroup$
    – rhermans
    Nov 1, 2014 at 9:05
  • 1
    $\begingroup$ Eternity is not 100000000 years. That's barely the time when dinosaurs ruled the earth. How is that an eternity? $\endgroup$
    – Asaf Karagila
    Nov 1, 2014 at 12:52
  • $\begingroup$ this is either a trick question, or poorly worded (likely a poor translation ). Literally we only re throw the portion of the dice from the first bullet on each iteration, so the process will stop after a half dozen throws with on average 50/50 odd/even mix. $\endgroup$
    – george
    Nov 1, 2014 at 14:01
  • $\begingroup$ Nothing tricky, fairly simple solution, but the question is poorly explained. The solution does not converge to a single value for longer times, so the $10^8$ years are irrelevant. The question should ask either by the average number or for the distribution of numbers and not for the exact number. $\endgroup$
    – rhermans
    Nov 1, 2014 at 18:31
  • 5
    $\begingroup$ Does this answer your question? How many even numbers will $99$ dice show if we roll them for eternity under a certain condition? $\endgroup$
    – ViHdzP
    Dec 21, 2019 at 7:01

3 Answers 3

3
$\begingroup$

OK, its not about Mathematica, but let's make it about using Mathematica to visualize the result, just for fun.

Analytic

The first run produces some number of nE even numbers with probability

pe0 = PDF[BinomialDistribution[99, 1/2], nE]

Any number from 0 to 99 is possible, justifying the last rule.

enter image description here

Irrespective of the initial distribution, on equilibrium the probability of changing an even number for an odd number must be equal to changing from an odd to an even

Solve[pe == (1 - pe)/2, pe]
{{pe -> 1/3}}

That means in average 1/3 even, 2/3 odd.

Simulation

start = RandomChoice[Range[6], 99];
BarChart[Apply[Labeled, Reverse[Sort@Tally[start], 2], {1}]]

enter image description here

f = Block[
   {rndIndx = RandomInteger[{1, 99}], new},
   new = If[EvenQ@Part[#, rndIndx], 1, RandomInteger[{1, 6}]];
   ReplacePart[#, rndIndx -> new]
   ] &

reslist = NestList[f, start, 100000];
evol = Transpose[(#/Total[#]) &[Part[Sort@Tally[EvenQ[#]], All, 2]] & /@ reslist];
ListLogLinearPlot[evol, Joined -> True, Epilog -> {Line[{{0, 1/3}, {100000, 1/3}}], Line[{{0, 2/3}, {100000, 2/3}}]},
 PlotRange -> {{1, 100000}, {0, 1}},
 Frame -> True
 ]

enter image description here

Analysis

As we iterate there will be random fluctuations continuously changing the number of odd and even numbers. The probability of creating a 1 is bigger than any other number. After a couple thousand iterations most of the numbers are 1

Sort@Tally[Last@reslist]
{{1, 37}, {2, 9}, {3, 10}, {4, 17}, {5, 15}, {6, 11}}
 BarChart[Apply[Labeled, Reverse[%, 2], {1}]]

enter image description here

And the distribution of even and odd numbers is centred around

N[Mean /@ evol]
{0.666522, 0.333478}

or 66.65% Odd, and 33.35% even, very close to 2/3 and 1/3 predicted.

The variation about that average is considerable:

N[StandardDeviation /@ evol]
{0.048476, 0.048476}

so the answer can not be given as a specific number, but as a distribution.

SmoothHistogram[evol, 0.01, Frame -> True, 
 Epilog -> {Line[{{1/3, 0}, {1/3, 9}}], Line[{{2/3, 0}, {2/3, 9}}]}, 
 PlotLabel -> "Probability Distribution", 
 FrameLabel -> {"Proportion", "Probability density"}]

enter image description here

Conclusion

After a not so long time, provided a couple of thousand iterations have pass, with more than 95% probability you will find a pile with roughly between 57% to 76% odd numbers. Only the average number of odds tends to 2/3 in the limit where the samples goes to infinity. The exact number of a particular instance can not be determined, but the most likely outcome will be 33 even, 66 odds of which a one (1) will be chosen to be rolled again.

enter image description here

$\endgroup$
1
  • $\begingroup$ +1 just for the sheer length and time spent on the answer. $\endgroup$
    – naslundx
    Nov 1, 2014 at 12:38
2
$\begingroup$

Using Mathematica:

Clear[a, n, m, even];

For n dice, half are initially even and become odd, the other half are flipped and half of those flipped end up even. So 1/4 are even after the first iteration.

even[1] = n/4;

For each iteration, all of evens become odd and half of the remainder are even after their flip.

even[m_] := even[m] = (n - even[m - 1])/2;

Looking at the tailing end of 100 iterations

Take[Table[even[m], {m, 1, 100}], -3] // N

{0.333333 n, 0.333333 n, 0.333333 n}

This indicates that the limit is tending to n/3.

Clear[even]

even[m_] = 
 a[m] /. RSolve[{a[m] == (n - a[m - 1])/2, a[1] == n/4}, a[m], m][[1]] // 
  ExpandAll

(1/3)*(-1)^(2*m)n + (1/3)(-1)^m* 2^(-1 - m)*n

Since m is a positive integer, even[m] can be restructured to n/3 (1 + (1/2)*(-1/2)^m)

even[m] == n/3 (1 + (1/2)*(-1/2)^m) //
 Simplify[#, {Element[m, Integers], m > 0}] &

True

Limit[n/3 (1 + (1/2)*(-1/2)^m), m -> Infinity]

n/3

For n = 99, after an infinite number of iterations the number of dice with even numbers up is statistically 33.

$\endgroup$
0
$\begingroup$

FOOD FOR THOUGHT: To better understand these numbers one must consider what these numbers mean. They are by example as odds are prime numbers which are the truest odds, these numbers as evens are the truest evens. 1,3,5,7,11 etc... are prime numbers. As with these numbers they continue forever. However, prime numbers start out with less numbers than the numbers able to be put on dice but continue to become more often than the numbers able to be put on dice as these numbers increase. So, half of every one of these even numbers able to be put on dice are 1,2,3,4,5,6,10,15,50 and they continue always having fewer halves of these evens that make odds than halves making evens. One can find a mathematical way to depict which numbers come next. Here are my notes: First of all, though half of every other even is an even, being that half of the even before is an odd. But as these numbers increase there are fewer and fewer halves of the numbers able to be put on dice that are odds. And more and more halves of these numbers are evens. But, 2 fits every definition of a prime number except that it is an even. Only 1 and itself go into prime numbers. Yet, 2 goes into all evens and one goes into all whole positive numbers because 2 odds make an even and any amount of evens make an even when added together. That statement is obvious but if you look deeper that is a knot which ties all numbers together. Think of negatives. Negative numbers do not have a beginning but do have an end. Hence -1 is the last and largest negative. Negatives are always bigger than the one before. As positives being opposites the two must always have an equal and opposite relationship. Hence there is no largest positive each after being larger than the one before. It's all about equality considering odds and evens as well. I'd really like to explain myself as there is a huge knot of infinity that ties all numbers together. Some of this might be out of place but I think this will better explain this question better.

$\endgroup$
1
  • 1
    $\begingroup$ I'm having trouble following your answer: particularly the bits where you talk about numbers larger than 6, and where you say that 2 fits the definition of every prime number except that is it even (being even doesn't disqualify 2 from being prime, it just makes it unique amongst primes). $\endgroup$
    – postmortes
    Jun 1, 2017 at 19:01