Ready for the next challenge?

"5 Guys and a Bunch of Coconuts"

Here is a link to the text description of the problem.


That link is to the repo, and my solution is in it as well.


I decided to take a stand at finding this solution mathematically without the brute Force approach applied in the source. I want to solve for the answer (the most efficient answer).

So far I framed the question mathematically and reduced. All I need to do is find the smallest value of T_R that produces Integer solutions for the following 5 equations and I will have a solution... I'll be finished soon hopefully.

@freemo surely it should be doable, as I proved out the result using 'bc' on the command line.

My work friend tried it in his head while doing a run the other day, and came up with a result far larger than appropriate.

Another friend solved it as a function that is nested 5 deep, and at the bottom it takes 5x as a starter.

With the function being f(i) {5/4 * i + 1}... Something like that. I think there was more to it than that, but once you found the right value for x it should all balance out. In that case I think you still had to figure out the x such that 5/4 x was equally divisible by 5. I guess that would still require some brute force testing.

@Absinthe @freemo I did it like your second friend (i.e., the nested function, checking that the result is an integer).

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves. A STEM-oriented instance.

An inclusive free speech instance.
All cultures and opinions welcome.
Explicit hate speech and harassment strictly forbidden.
We federate with all servers: we don't block any servers.