0.0.1 • Published 5 years ago

@srcer/infoarmor-exercise v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

InfoArmor Coding Exercise

Test Status

An island is inhabited by five men and a pet monkey. One afternoon the men gathered a large pile of coconuts, which they proposed to divide equally among themselves the next morning. During the night one of the men awoke and decided to help himself to his share of the nuts. In dividing them into five equal parts he found that there was one nut left over. This one he gave to the monkey. He then hid his one-fifth share, leaving the rest in a single pile. Later during the night another man awoke with the same idea in mind. He went to the pile, divided it into five equal parts, and found that there was one coconut left over. This he gave to the monkey, and then he hid his one-fifth share, restoring the rest to one pile. During the same night each of the other three men arose, one at a time, and in ignorance of what had happened previously, went to the pile, and followed the same procedure. Each time one coconut was left over, and it was given to the monkey. The next morning all five men went to the diminished nut pile and divided it into five equal parts. finding that one nut remained over. What is the least number of coconuts the original pile could have contained? Write a function/program to solve this problem. You should be able to input any number of men and any monkey's share.
For example, to solve the problem as given, your function/program would take 5 for the number of men and 1 for the monkey's share.

0.0.1

5 years ago