<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/cyclic-riddle-not-in-nyc/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://xianblog.wordpress.com/2017/12/29/cyclic-riddle/"> R – Xi'an's Og</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><strong><a rel="nofollow" href="https://xianblog.files.wordpress.com/2017/12/riddler1222.jpg" target="_blank"><img data-orig-file="https://xianblog.files.wordpress.com/2017/12/riddler1222.jpg?w=328&amp;h=328&amp;fit=328%2C328&amp;resize=328%2C328" data-orig-size="480,480" data-medium-file="https://xianblog.files.wordpress.com/2017/12/riddler1222.jpg?w=328&amp;h=328&amp;fit=328%2C328&amp;resize=328%2C328?w=300" data-attachment-id="35087" data-image-meta="{" data-image-description="" src="https://xianblog.files.wordpress.com/2017/12/riddler1222.jpg?w=328&h=328&fit=328%2C328&resize=328%2C328" data-permalink="https://xianblog.wordpress.com/2017/12/29/cyclic-riddle/riddler1222/" data-large-file="https://xianblog.files.wordpress.com/2017/12/riddler1222.jpg?w=328&amp;h=328&amp;fit=328%2C328&amp;resize=328%2C328?w=450" alt="" data-image-title="" sizes="(max-width: 328px) 100vw, 328px" width="328" data-comments-opened="1" class="wp-image-35087" data-recalc-dims="1" height="328"></a>I</strong>n the <a rel="nofollow" href="https://fivethirtyeight.com/features/hark-two-holiday-puzzles/" target="_blank">riddle of this week</a> on <a rel="nofollow" href="https://fivethirtyeight.com/features/hark-two-holiday-puzzles/" target="_blank">fivethirtyeight</a>, the question is to find the average number of rounds when playing the following game: P=6 players sitting in a circle each have B=3 coins and with probability 3⁻¹ they give one coin to their right or left side neighbour, or dump the coin to the centre. The game ends when all coins are in the centre. Coding this experiment in R is rather easy</p>
<pre>situz=rep(B,P)
r=1
while (max(situz)>0){
 unz=runif(P)
 newz=situz-(situz>0)
 for (i in (1:P)[unz&lt;1/3]) 
  newz[i%%P+1]=newz[i%%P+1]+(situz[i]>0)
 for (i in (1:P)[unz>2/3])
  newz[i-1+P*(i==1)]=newz[i-1+P*(i==1)]+(situz[i]>0)
 situz=newz
 r=r+1}
</pre>
<p>resulting in an average of 15.58, but I cannot figure out (quickly enough) an analytic approach to the problem. (The fit above is to a Gamma(â-1,ĝ) distribution.)</p>
<p><a rel="nofollow" href="https://xianblog.files.wordpress.com/2014/09/barbacycle.jpg" target="_blank"><img data-orig-file="https://xianblog.files.wordpress.com/2014/09/barbacycle.jpg" data-orig-size="1280,1914" data-medium-file="https://xianblog.files.wordpress.com/2014/09/barbacycle.jpg?w=201" data-attachment-id="25309" data-image-meta="{" data-image-description="" src="https://xianblog.files.wordpress.com/2014/09/barbacycle.jpg?w=183&h=274&fit=183%2C274&resize=183%2C274" data-permalink="https://xianblog.wordpress.com/2014/10/18/art-brut-64/barbacycle/" data-large-file="https://xianblog.files.wordpress.com/2014/09/barbacycle.jpg?w=183&amp;h=274&amp;fit=183%2C274&amp;resize=183%2C274" alt="" data-image-title="barbacycle" sizes="(max-width: 183px) 100vw, 183px" width="183" data-comments-opened="1" class="wp-image-25309" data-recalc-dims="1" height="274"></a>In a completely unrelated aparté (aside), I <a rel="nofollow" href="https://www.citylab.com/transportation/2017/11/why-does-new-york-city-ban-ebikes/544829/" target="_blank">read earlier this week</a> that New York City had prohibited the use of electric bikes. I was unsure of what this meant (prohibited on sidewalks? expressways? metro carriages?) so rechecked and found that electric bikes are simply not allowed for use anywhere in New York City. Because of the potential for “reckless driving”. The target is apparently the high number of delivery e-bikes, but this ban sounds so absurd that I cannot understand it passed. Especially when <a rel="nofollow" href="https://qz.com/995215/if-trump-pulls-out-of-the-paris-climate-agreement-bill-de-blasio-eric-garcetti-and-other-us-mayors-say-theyll-pick-up-the-slack/" target="_blank">De Blasio has committed the city to the Paris climate agreement</a> after Trump moronically dumped it… Banning the cars would sound much more in tune with this commitment! (A further aparté is that I strongly dislike e-bikes, running on nuclear power plants,  especially when they pass me on sharp hills!, but they are clearly a lesser evil when compared with mopeds and cars.)</p>
<p>Filed under: <a rel="nofollow" href="https://xianblog.wordpress.com/category/kids/" target="_blank">Kids</a>, <a rel="nofollow" href="https://xianblog.wordpress.com/category/statistics/r-statistics/" target="_blank">R</a>, <a rel="nofollow" href="https://xianblog.wordpress.com/category/running/" target="_blank">Running</a>, <a rel="nofollow" href="https://xianblog.wordpress.com/category/travel/" target="_blank">Travel</a> Tagged: <a rel="nofollow" href="https://xianblog.wordpress.com/tag/car-accidents/" target="_blank">car accidents</a>, <a rel="nofollow" href="https://xianblog.wordpress.com/tag/e-bike/" target="_blank">e-bike</a>, <a rel="nofollow" href="https://xianblog.wordpress.com/tag/electric-bike/" target="_blank">electric bike</a>, <a rel="nofollow" href="https://xianblog.wordpress.com/tag/fivethirtyeight/" target="_blank">FiveThirtyEight</a>, <a rel="nofollow" href="https://xianblog.wordpress.com/tag/game/" target="_blank">game</a>, <a rel="nofollow" href="https://xianblog.wordpress.com/tag/mathematical-puzzle/" target="_blank">mathematical puzzle</a>, <a rel="nofollow" href="https://xianblog.wordpress.com/tag/new-york-city/" target="_blank">New York city</a>, <a rel="nofollow" href="https://xianblog.wordpress.com/tag/r/" target="_blank">R</a>, <a rel="nofollow" href="https://xianblog.wordpress.com/tag/random-walk/" target="_blank">random walk</a>, <a rel="nofollow" href="https://xianblog.wordpress.com/tag/reckless-driving/" target="_blank">reckless driving</a>, <a rel="nofollow" href="https://xianblog.wordpress.com/tag/the-riddler/" target="_blank">The Riddler</a> <a rel="nofollow" href="https://feeds.wordpress.com/1.0/gocomments/xianblog.wordpress.com/35086/" target="_blank"><img border="0" alt="" src="https://feeds.wordpress.com/1.0/comments/xianblog.wordpress.com/35086/"></a> <img border="0" src="https://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" alt="" width="1" data-recalc-dims="1" height="1"></p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://xianblog.wordpress.com/2017/12/29/cyclic-riddle/"> R – Xi'an's Og</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/cwgstNpYiFE" height="1"></a></div>