@zingbretsen @freemo Also, I think we need to include #toyprogrammingchallenge hashtag in the conversational posts of they are lost on other instances
I do like the solution, and to my eye the code looks great. I could not get it to compile on :
https://rextester.com/l/python3_online_compiler
I might be doing something wrong though.
@Absinthe They are readable here, should be good. Let me know if you have any questions on the math
@freemo the numbers are good, but I can't follow the screen grabs on my phone. Maybe more readable on the computer screen. Will see later.
@Absinthe
This was a lot of fun decided to do the problem by hand using non brute Force techniques. Attached are all the steps I used to solve the problem including the final solution on the last page.
Total number of coconuts is 3,121 at the start. The number of coconuts they ended up with was the following: 828, 703, 603, 523, 459
If your following the pages I attached the order in which you follow them is "knowns/reduce" then "All valid values" then "final solution"
How about something like this:
def func(x):
if x % 5 == 1:
return (x - 1) / 5 * 4
return 0
x = 6
while True:
if func(func(func(func(func(x))))):
break
x += 5
print(x)
@zingbretsen @freemo did you post it somewhere?
@remulacfrommars you should donate a pint, they'll tell you what it is
@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.
f(f(f(f(f(5x)))))
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.
@Ghosty occasionally something like midnight commander might be useful for side by side stuff, but meld usually does that for what I need.
#toyprogrammingchallenge #python #lisp #c #c++ #cpp #coding #programming
Ready for the next challenge?
"5 Guys and a Bunch of Coconuts"
Here is a link to the text description of the problem.
https://git.qoto.org/Absinthe/coconuts/blob/master/coconuts.txt
That link is to the repo, and my solution is in it as well.
@Ghosty occasionally I will launch dolphin or nautilus because you to allows me to run a program by its association. However gnu-open or kde-open5 seems to handle such things. But I do like meld for directory comparisons. Does that count?
A comparison of the flex / style across 3 of my flex pens. The first I made myself from a 120 year old Waterman nib. The second is a stock falcon pilot, the last one is my hand customized Custom 912 (With Motishaw Spencerian modification)
@zingbretsen I'm on qoto.org does that count?
What Mastodon instances do #python, #R, and #datascience people hang out on?
The green faerie