From a2a55fc3e537373a4edc3f90f518471e22ed4ccf Mon Sep 17 00:00:00 2001
From: "Bradley M. Small" <bradley_small@hotmail.com>
Date: Thu, 19 Sep 2019 23:19:27 -0400
Subject: [PATCH] adding the description`

---
 coco.py      | 17 ++++++++++++++++-
 coconuts.txt | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 coconuts.txt

diff --git a/coco.py b/coco.py
index 10ef953..e8cb364 100755
--- a/coco.py
+++ b/coco.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python3
 
-
+running_count = [0,0,0,0,0] 
 def splitthem(quant):
     """
     take a quantity and return False if it is not one more than 
@@ -11,6 +11,11 @@ def splitthem(quant):
     if quant[0] % 5 != 1:
         return False
     else:
+        t = quant[0]//5
+        for k in range(5):
+            if running_count[k] == 0:
+                running_count[k] = t
+                break
         quant[0] -= (1 + quant[0]//5) 
     return True
 
@@ -29,6 +34,8 @@ def testnum(num):
             return False
 
     if num[0] % 5 == 0:
+        for i in range(5):
+            running_count[i] += num[0]//5
         return True
     else:
         return False
@@ -46,9 +53,17 @@ def main():
 
     num = [0]
     for n in range(1, TESTQUANTITY):
+        for i in range(5):
+            running_count[i] = 0
+
         num[0] = n
         if testnum(num):
             print ("The Number Was %d" % n)
+            print (running_count)
+            total = 0
+            for i in running_count:
+                total += i
+            print (total)
             return
 
     print ("Not found in %d tries." % TESTQUANTITY)
diff --git a/coconuts.txt b/coconuts.txt
new file mode 100644
index 0000000..237f6b5
--- /dev/null
+++ b/coconuts.txt
@@ -0,0 +1,36 @@
+Five guys get shipwrecked on a deserted island. They start off friendly and
+spend the whole day collecting all the coconuts they can find. By the time it
+gets dark they have gotten on each other's nerves to the point that they decide
+to divey up their cocounts and go their separate ways. Since it has gotten
+dark, they decide that they will sleep and take care of the details in the
+morning. 
+
+A little while after they all go to bed, one of them wakes up and decides that
+he doesn't trust the rest of them not to take all the coconuts for themselves
+and leave him out cold. So he goes to the pile, meticulously separates the
+coconuts into 5 perfectly equal piles and finds that there is one left over, so
+he tosses that one to a local monkey who just happened to be watching him with
+some curiousity. He then takes his fair 1/5 back to his bunk and squishes the
+pile back together. Then he goes back to his bunk and goes to sleep. 
+
+By the time he falls back to sleep a second guy wakes up and has the same exact
+concern. He executes the same separation on the pile that is left. When he
+splits it into 5 piles, he also finds that there is one left over, and again
+tosses the extra one to the monkey. Then he takes his fair 1/5, pushes the rest
+of the pile back together stows his coconuts in his bunk and then he goes back
+to sleep.
+
+As you can guess, the next 3 guys all go through the same scenario, each of
+them finding exactly 1 extra coconut to the delight of the waiting monkey. Each
+take their fair 1/5 of the remaining coconuts and go back to sleep. 
+
+In the light of morning, none of them is going to admit to their nocturnal
+excursions so they split the pile into 5 and amazingly, to the chagrin
+of the monkey, there was no extra one this time. They each take their pile, and
+the ones they collected during the night and went about their way never to be
+seen again.
+
+The puzzle is to determine what is the minimum possible number of coconuts that
+they started with in the pile at the beginning of the night?
+
+Extra credit if you can determine how many each of them ended up with?
-- 
GitLab