{"id":162,"date":"2015-05-02T23:31:58","date_gmt":"2015-05-02T23:31:58","guid":{"rendered":"http:\/\/perfectionatic.org\/?p=162"},"modified":"2015-05-03T10:04:19","modified_gmt":"2015-05-03T10:04:19","slug":"monkeys-and-coconuts","status":"publish","type":"post","link":"https:\/\/perfectionatic.org\/?p=162","title":{"rendered":"Monkeys and Coconuts"},"content":{"rendered":"<p>Here is my  attempt to solve the <a href=\"https:\/\/www.youtube.com\/watch?v=U9qU20VmvaU&amp;feature=em-subs_digest\">monkeys and coconuts<\/a> problem. The story goes<br \/>\nthat five sailors were stranded on an island and had decided to gather some<br \/>\ncoconuts for their provisions. They put all the coconuts in one large pile and<br \/>\nwent to sleep. One sailor got up and fearing that there could be problems when the<br \/>\ntime to came to divide the pile, he divided the pile five ways and noticing that<br \/>\nhe has an extra coconut, he gave it to a monkey, and then hid his stash. The other<br \/>\nfour sailor repeated the same procedure. When they woke up they noticed that<br \/>\nthey had a smaller pile and proceeded to divide into five equal piles, this time<br \/>\naround there were no extra coconut left for the monkey. So the question is: what was<br \/>\nthe size of the original pile?<\/p>\n<p>We will denote by \\(x_i\\) as the size of the<br \/>\npile after the \\(i\\)th sailor has carried out his procedure. In this system \\(x_0\\)<br \/>\nis original size of the pile. So following this procedure we then proceed as<br \/>\nfollows:<\/p>\n<p>\\(x_1=\\frac{4(x_0-1)}{5}\\)<br \/>\n\\(\\cdots\\)<br \/>\n\\(x_i=\\frac{4(x_{i-1}-1)}{5}\\)<br \/>\n\\(\\cdots\\)<br \/>\n\\(x_5=\\frac{4(x_4-1)}{5}\\)<\/p>\n<p>It is important to note that \\(x_i \\in \\mathbb{N}_0\\) for \\(i=0\\ldots5\\), also \\(\\frac{x_5}{5}\\in \\mathbb{N}_0\\). Alternatively, we think of the reverse procedure and express the above as<br \/>\n\\(x_4=\\frac{5x_5}{4}+1\\)<br \/>\n\\(\\cdots\\)<br \/>\n\\(x_i=\\frac{5x_{i+1}}{4}+1\\)<br \/>\n\\(\\cdots\\)<br \/>\n\\(x_0=\\frac{5x_1}{4}+1\\)<\/p>\n<p>Observing that \\(x_5\\) has to be divisible by 4 and 5 (last equation in the first system and first equation in the second), one can brute force the solution(s) by the following Julia code:<br \/>\nhttps:\/\/gist.github.com\/mbeltagy\/129a584c21ce56ac3b60<br \/>\nWhich results in<\/p>\n<pre><code>[2496,1996,1596,1276,1020]\nm=51, x\u2080= 3121\n[14996,11996,9596,7676,6140]\nm=307, x\u2080= 18746\n[27496,21996,17596,14076,11260]\nm=563, x\u2080= 34371\n[39996,31996,25596,20476,16380]\nm=819, x\u2080= 49996\n<\/code><\/pre>\n<p>This corresponds nicely to the answers that were obtained by rigorous derivation in the video, however it shows how programming can easily find such solutions by brute force.<\/p>\n<p>If one would like to avoid the negative or blue concocts suggested in the video and also preserve the monkey. Below is an alternative derivation. Working through the first system, one gets:<\/p>\n<p>$latex x_{5}={{4\\,\\left({{4\\,\\left({{4\\,\\left({{4\\,\\left({{4\\,\\left(x_{0}-<br \/>\n 1\\right)}\\over{5}}-1\\right)}\\over{5}}-1\\right)}\\over{5}}-1\\right)<br \/>\n }\\over{5}}-1\\right)}\\over{5}}=\\frac{4^5x_0}{5^5}-\\frac{8404}{5^5}$<\/p>\n<p>Hence,<br \/>\n\\(5^5x_5=4^5x_0-8404\\).<br \/>\nRealizing the \\(x_5\\) has to be necessarily divisible by 5, we denote the final share that each sailor gets in the last division by \\(s\\). So our Diophantine equation becomes<br \/>\n\\(5^6s=4^5x_0-8404\\).<br \/>\nIt will have solutions at \\(x_0=3121, 18746, 34371 \\ldots= 3121+n5^6 \\text{ for } n \\in \\mathbb{N}_0 \\).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is my attempt to solve the monkeys and coconuts problem. The story goes that five sailors were stranded on an island and had decided to gather some coconuts for their provisions. They put all the coconuts in one large pile and went to sleep. One sailor got up and fearing that there could be [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[62,71],"tags":[],"class_list":["post-162","post","type-post","status-publish","format-standard","hentry","category-math","category-programming"],"_links":{"self":[{"href":"https:\/\/perfectionatic.org\/index.php?rest_route=\/wp\/v2\/posts\/162","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/perfectionatic.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/perfectionatic.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/perfectionatic.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/perfectionatic.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=162"}],"version-history":[{"count":19,"href":"https:\/\/perfectionatic.org\/index.php?rest_route=\/wp\/v2\/posts\/162\/revisions"}],"predecessor-version":[{"id":183,"href":"https:\/\/perfectionatic.org\/index.php?rest_route=\/wp\/v2\/posts\/162\/revisions\/183"}],"wp:attachment":[{"href":"https:\/\/perfectionatic.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=162"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/perfectionatic.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=162"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/perfectionatic.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}