    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
     <channel>
        <title>ACCU  :: On Share and Share Alike</title>
        <link>https://members.accu.org/index.php/articles/2438</link>
        <description>Professionalism in Programming</description>
        <dc:language>en-us</dc:language> 
        <dc:creator>Administrator</dc:creator> 
        <admin:generatorAgent rdf:resource="http://www.xaraya.org" /> 
        <admin:errorReportsTo rdf:resource="mailto:webeditor@accu.org" />
       <sy:updatePeriod>hourly</sy:updatePeriod>
       <sy:updateFrequency>1</sy:updateFrequency>
       <docs>http://backend.userland.com/rss</docs>




<div class="xar-mod-head"><span class="xar-mod-title">CVu Journal Vol 29, #5 - November 2017</span></div>

<table border="0" cellpadding="1" cellspacing="0">
    <tbody>
    <tr>
        <td valign="top">
            Browse in :
       </td>
       <td valign="top">

                                            <a href="https://members.accu.org/index.php/articles/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c76/">Journals</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c77/">CVu</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c379/">295</a>
<br />
</td>
   </tr>
   </tbody>
</table>




<div class="xar-error">
   <p>
 <strong>Note:</strong> when you create a new publication type,
the articles module will automatically use the templates
<em>user-display-[publicationtype].xt</em>
and <em>user-summary-[publicationtype].xt</em>.
If those templates do not exist when you try to preview or display a new article,
you'll get this warning :-)  Please place your own templates in themes/<em>yourtheme</em>/modules/articles . The templates will get the extension .xt there. </p>
</div>
<div class="xar-norm xar-standard-box-padding">
   <h1><strong>Title:</strong>&nbsp;On Share and Share Alike</h1>
<p><strong>Author:</strong>&nbsp;Bob Schmidt</p>
<p>
<strong>Date:</strong> 09 November 2017 17:01:27 +00:00 or Thu, 09 November 2017 17:01:27 +00:00</p>
<p><strong>Summary:</strong>&nbsp;A Student gets to grips with the Baronâ€™s coin puzzle.</p>
<p><strong>Body:</strong>&nbsp;<p>When last they met, the Baron challenged Sir R----- to a wager in which, for a price of three coins and fifty cents, he would make a pile of two coins upon the table. Sir R----- was then to cast a four-sided die and the Baron would add to that pile coins numbering that upon which it settled. The Baron would then make of it as many piles of equal numbers of no fewer than two coins as he could muster and take back all but one of them for his purse. After doing so some sixteen times, Sir R----- was to have as his prize the remaining pile of coins.</p>

<p>The upshot of these rules is that at each turn the pile of coins would be reduced to the lowest prime factor of the number that it had after those indicated by the die were added, the primes being those positive integers that cannot be wholly divided by any positive integers other than themselves and one. For example, if Sir R----- had started a turn with seventeen coins and had thrown a one then he would have ended it with</p>

<p style="margin-left:1em">
	<img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn0.svg" />
</p>

<p>coins.</p>

<p>The first consequence of this is that the pile could only consist of a prime number of coins at the end of a turn.</p>

<p>The second is that it could never be larger than twenty three coins, since</p>

<p style="margin-left:1em">
	<img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn1.svg" />
</p>

<p>We need therefore only consider the implications of the rules of the wager for piles of two, three, five, seven, eleven, thirteen, seventeen, nineteen and twenty three coins in order to figure its fairness.</p>

<p>If we construct a table showing how many ways Sir R----- could start and end a turn with some numbers of coins in the pile by column and row respectively</p>

<table>
	<tr>
		<th colspan="2">&#160;</th>
		<th colspan="9">Start</th>
	</tr>
	<tr>
		<th colspan="2">&#160;</th>
		<th>2</th>
		<th>3</th>
		<th>5</th>
		<th>7</th>
		<th>11</th>
		<th>13</th>
		<th>17</th>
		<th>19</th>
		<th>23</th>
	</tr>

	<tr>
		<th rowspan="9">End</th>
		<td>2</td>
		<td>2</td>
		<td>2</td>
		<td>2</td>
		<td>2</td>
		<td>2</td>
		<td>2</td>
		<td>2</td>
		<td>2</td>
		<td>2</td>
	</tr>

	<tr>
		<td>3</td>
		<td>1</td>
		<td>&#160;</td>
		<td>1</td>
		<td>1</td>
		<td>1</td>
		<td>1</td>
		<td>1</td>
		<td>1</td>
		<td>1</td>
	</tr>

	<tr>
		<td>5</td>
		<td>1</td>
		<td>1</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>1</td>
	</tr>

	<tr>
		<td>7</td>
		<td>&#160;</td>
		<td>1</td>
		<td>1</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
	</tr>

	<tr>
		<td>11</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>1</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
	</tr>

	<tr>
		<td>13</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>1</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
	</tr>

	<tr>
		<td>17</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>1</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
	</tr>

	<tr>
		<td>19</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>1</td>
		<td>&#160;</td>
		<td>&#160;</td>
	</tr>

	<tr>
		<td>23</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>&#160;</td>
		<td>1</td>
		<td>&#160;</td>
	</tr>
</table>

<p>create a matrix of its elements, and multiply it by one quarter</p>

<p style="margin-left:1em">
	<img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn2.svg" />
</p>

<p>then the result <img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn3.svg" /> is the transition matrix of a turn, representing the probabilities of beginning and ending it with the numbers of coins associated with the tableâ€™s columns and rows.</p>

<p>If we further define a vector <img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn4.svg" /> with</p>

<p style="margin-left:1em">
	<img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn5.svg" />
</p>

<p>where <img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn6.svg" /> is the probability that the pile contains <img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn7.svg" /> coins at the start of a turn, then <img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn8.svg" /> is a vector whose elements correspond to the probabilities that it should contain a given number of coins at the end of that turn.</p>

<p>That this is necessarily so follows firstly from the fact that the transitions from a particular starting number of coins to a particular ending number are independent, meaning that we may simply multiply the probabilities of the former by the probabilities of those transitions and add together the resulting probabilities of each of the latter and secondly that, by the rules of matrix-vector multiplication, we have</p>

<p style="margin-left:1em"><img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn9.svg" /></p>

<p>where <img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn10.svg" /> is the summation sign, which is trivially that sum of the products of those probabilities.</p>

<p>Now it must also be the case that if the probabilities of the pile having particular numbers of coins at the start of a turn are <img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn11.svg" />, then at the end of that turn they must be</p>

<p style="margin-left:1em"><img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn12.svg" /></p>

<p>and so if they were instead <img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn13.svg" /> at the start of a turn, they will be <img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn14.svg" /> at the end of the following turn, since the rolls of the die at each turn are also independent.</p>

<p>Carrying on in the same fashion, we find that if the probabilities were <img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn15.svg" /> at the start of the game, then they should be <img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn16.svg" /> at its conclusion.</p>

<p>Such probabilistic systems are known as Markov chains and are of tremendous utility when it comes to figuring the probabilities of the outcomes of processes for which the transitions between various states at any given time are independent of those that have come before, not least for the ease with which we may use matrices and vectors to do so. I said as much to the Baron, but I fear that I may not have had his full attention.</p>

<p>Now we may spare ourselves some considerable effort by noting that</p>

<p style="margin-left:1em"><img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn17.svg" /></p>

<p>and so we need but four matrix multiplications to figure the probabilities of the pile having any particular number of coins at the gameâ€™s end. With some small measure of patience my fellow students and I have reckoned these to equal</p>

<p style="margin-left:1em"><img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn18.svg" /></p>

<p>Since the probability of having two coins in the pile at the outset equals one, the initial probability vector must have a one for its first element and zero for the rest and so the product of a matrix and it is simply equal to the first column of that matrix, giving us a probability vector at the end of the game of</p>

<p style="margin-left:1em"><img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn19.svg" /></p>

<p>Finally, Sir R-----â€™s expected prize was simply</p>

<p style="margin-left:1em"><img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn20.svg" /></p>

<p>which comes out to</p>

<p style="margin-left:1em"><img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn21.svg" /></p>

<p>Now the cost of the wager was</p>

<p style="margin-left:1em"><img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn22.svg" /></p>

<p>and so this represents a slight loss for Sir R----- and I should have advised him to decline it. <img style="max-width:VISUALLY_DETERMINED%" src="/content/images/journals/cvu29-5/Student/eqn23.svg" /></p>

<h2>Acknowledgement</h2>
<p>Courtesy of <a href="www.thusspakeak.com">www.thusspakeak.com</a></p>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
