I started trying to solve this, and I was kind of disappointed when I couldn't get anywhere and had to go to brute force, but found out I shouldn't have been when I checked the comments. Obviously I didn't find a solution with brute force, but I got some decent 'near misses'. The best one was
🍎 = 10,180
🍌= 2,607
🍍 = 48,003
which gives 4 - 2.12x10^-12
There also seemed to be multiple classes of almost solutions. I'm not really sure what the difference is (mostly smaller pineapple values), but I had to calculate them differently. The second set didn't have as good of solutions, but I checked them too, and the best one I found was
🍎 = 8,600
🍌 = 1,599
🍍 = 688
which gives 4 + 1.80x10^-10
This was just limited to what my computer could find in a few minutes.
I spent way longer than I care to admit slapping together a Java program to chew through the first thousand or so. Here's the log output -- some get really damned close, but nothing exact (or within 16 decimal digit precision) yet.
Edit: re-running with an upper bound of 10,000 now. This will probably take a couple of hours since it's running a triple-nested loop without any duplicate checks.
Edit 2:
Found on Google+ by John Baez
https://plus.google.com/+johncbaez999
Don't try this puzzle
It looks childish, but this puzzle is sadistically difficult. Saying that 95% of people can't solve this is like saying 95% of people can't jump over a skyscraper.
Here is the simplest solution:
apple = 154476802108746166441951315019919837485664325669565431700026634898253202035277999
Cool, so using my current method all I need to get the solution is, uh, a million trillion trillion trillion trillion exabytes of RAM... per particle in the universe.
You can implement a sieve. I found that all 3 numbers have to be different and that you can assume that they don't share a common factor (also obviously you can assume that x<y<z so you don't have to recheck every one of the permutations), so you can skip these numbers for starters, and then you can figure out more restrictions.
It can definitely be optimized, but the point is that brute force isn't a viable option in the first place. Maybe with something GPU-based where you can stream a ludicrous number of simultaneous calculations, but I don't know if that will let you get into 80+ digit (roughly 67+ bit) values with exact precision. OpenCL caps out at 64-bit for integers, or at least used to:
(Edit: I don't know. I haven't worked with OpenCL. Me enterprise monkey. It sounds like you'd have to implement your own equivalent to BigDecimal/BigInteger around the GPU registers, which starts adding a lot of overhead for packing and unpacking your parameter triad values.)
...and then there's the problem of calculating exact-precision intermediate results. There's a reason the NSA pissed dump trucks full of money into PRISM.
Alright, I made a plot, and it turned out pretty cool. I had to limit it to something that could be shared, and where you could actually see the detail on a 1080p monitor, so I only did 0-2,000.
Every point represents a combination of apple and banana values where it's possible to choose the right pineapple value where you get close to 4. Specifically, where your difference from 4 is less than one part per million. For some combinations, you can pick either a large (in the 1000s) pineapple value, or a small (in the 100s) value. Separating these plots out, apparently you never get a good solution with a small pineapple value when the apple and banana values are too close.
Wish that's super cool, is definitely got a pattern going on. Looks almost like a fractal or interference. Also cool how you can see the linear area where there's no possible solution for pineapple.
Yeah, I kind of thought it was just going to look like static, but I was curious, and it was actually pretty interesting.
I was skeptical at first, because you can get patterns like that in cases like taking a picture of a computer screen, when the pixel grids don't line up, but I checked it at 0-200, when the data points are much larger than the monitor pixels, and the patterns are still there.
So I plotted the large pineapple solutions in 3d, and all of the points are almost perfectly in a plane, there's not much to see there. There's some asymptotic behavior here that means that at this scale, the large pineapple solution will always be close to 4*(apple+banana).
The small pineapple solutions were a little more interesting. They are in two separate planes on either side of the divide in the middle. You can see them here. I also raised the error tolerance to add more scatter points, and you can see that there are similar patterns here, the solutions are just sparser.
Edit: Here is the two solution sets together, for comparison.
I was gonna plot the (real) solution set to the original when I had some time, assuming the macOS Grapher utility can even compute it. Will try sage or something if that doesn’t work.
I was looking at the work @Pezevenk was doing with lower and upper bounds, and thought that could be used to make the 3d plot more meaningful. His inequalities say that we can iterate the lower and upper bounds with
U_(n+1)=4-1/(1+2*U_n)
L_(n+1)=4-1/(1+2*L_n)-1/L_n
which gives 3.6003 < c/(a+b) < 3.8861
Plotting this value instead of the actual pineapple value effectively exaggerates the deviations from a perfect plane. Now the points are on some kind of a curved 2d surface.
I thought it was interesting that the values only covered about a tenth of the allowed range. The real solution from google is very close to halfway between the bounds, so I would guess that someone could find tighter bounds (no idea how).
I'm not sure what to do with the small pineapple group, since the bounds don't apply to them. Although I suspect that this group might just be some of the same solutions with their variables swapped around.
I also added color to the 2d plots to show which combinations were closer to being solutions than others. I tried plotting the error as the Z-axis, and it just comes out as a cloud of gas. The only time I could see any noticeable pattern was the 2d patterns that you see when looking along the Z-axis
I really couldn't say. You'd probably need someone at least a little familiar with the analytical way of solving it. I looked at the explanation, and I have no idea how that stuff works.
I'm using python, but I'm trying to figure out what to actually put on the plot. I was thinking apple value as one axis, banana value as the other, then plotting a scatter of the 1000 or so best combinations that allow you to pick a good pineapple.
Maybe just plot the near misses? Anything within +/- 1 of the goal. Just do a 3d plot with xyz being the variables. Don't know if a scatter plot would be more visible, or a line plot.
I started trying to solve this, and I was kind of disappointed when I couldn't get anywhere and had to go to brute force, but found out I shouldn't have been when I checked the comments. Obviously I didn't find a solution with brute force, but I got some decent 'near misses'. The best one was
🍎 = 10,180
🍌= 2,607
🍍 = 48,003
which gives 4 - 2.12x10^-12
There also seemed to be multiple classes of almost solutions. I'm not really sure what the difference is (mostly smaller pineapple values), but I had to calculate them differently. The second set didn't have as good of solutions, but I checked them too, and the best one I found was
🍎 = 8,600
🍌 = 1,599
🍍 = 688
which gives 4 + 1.80x10^-10
This was just limited to what my computer could find in a few minutes.
Edit: Some plots I made working on this problem.
I spent way longer than I care to admit slapping together a Java program to chew through the first thousand or so. Here's the log output -- some get really damned close, but nothing exact (or within 16 decimal digit precision) yet.
spoiler
[INFO ] 2021-03-18 01:37:24.187 [main] Main - Beginning formula tester run. [INFO ] 2021-03-18 01:37:24.582 [main] FormulaTester - Found near match with error value of +/- 0.0000004298293256: 2, 264, 993 [INFO ] 2021-03-18 01:37:24.794 [main] FormulaTester - Found near match with error value of +/- 0.0000004298293256: 2, 993, 264 [INFO ] 2021-03-18 01:37:31.815 [main] FormulaTester - Found near match with error value of +/- 0.0000000953396933: 35, 132, 627 [INFO ] 2021-03-18 01:37:31.916 [main] FormulaTester - Found near match with error value of +/- 0.0000000953396933: 35, 627, 132 [INFO ] 2021-03-18 01:37:45.415 [main] FormulaTester - Found near match with error value of +/- 0.0000006695134379: 101, 133, 881 [INFO ] 2021-03-18 01:37:45.569 [main] FormulaTester - Found near match with error value of +/- 0.0000006695134379: 101, 881, 133 [INFO ] 2021-03-18 01:37:51.774 [main] FormulaTester - Found near match with error value of +/- 0.0000000953396933: 132, 35, 627 [INFO ] 2021-03-18 01:37:51.896 [main] FormulaTester - Found near match with error value of +/- 0.0000000953396933: 132, 627, 35 [INFO ] 2021-03-18 01:37:51.996 [main] FormulaTester - Found near match with error value of +/- 0.0000006695134379: 133, 101, 881 [INFO ] 2021-03-18 01:37:52.157 [main] FormulaTester - Found near match with error value of +/- 0.0000006695134379: 133, 881, 101 [INFO ] 2021-03-18 01:38:19.067 [main] FormulaTester - Found near match with error value of +/- 0.0000004298293256: 264, 2, 993 [INFO ] 2021-03-18 01:38:19.274 [main] FormulaTester - Found near match with error value of +/- 0.0000004298293256: 264, 993, 2 [INFO ] 2021-03-18 01:39:34.405 [main] FormulaTester - Found near match with error value of +/- 0.0000000953396933: 627, 35, 132 [INFO ] 2021-03-18 01:39:34.426 [main] FormulaTester - Found near match with error value of +/- 0.0000000953396933: 627, 132, 35 [INFO ] 2021-03-18 01:40:26.750 [main] FormulaTester - Found near match with error value of +/- 0.0000006695134379: 881, 101, 133 [INFO ] 2021-03-18 01:40:26.757 [main] FormulaTester - Found near match with error value of +/- 0.0000006695134379: 881, 133, 101 [INFO ] 2021-03-18 01:40:51.955 [main] FormulaTester - Found near match with error value of +/- 0.0000004298293256: 993, 2, 264 [INFO ] 2021-03-18 01:40:52.016 [main] FormulaTester - Found near match with error value of +/- 0.0000004298293256: 993, 264, 2 [INFO ] 2021-03-18 01:40:53.853 [main] FormulaTester - No valid solutions found for range 0 to 1000. [INFO ] 2021-03-18 01:40:53.853 [main] Main - Formula tester run complete.
Edit: re-running with an upper bound of 10,000 now. This will probably take a couple of hours since it's running a triple-nested loop without any duplicate checks.
Edit 2:
...I think it is going to be running for a while.
Cool, so using my current method all I need to get the solution is, uh, a million trillion trillion trillion trillion exabytes of RAM... per particle in the universe.
You can implement a sieve. I found that all 3 numbers have to be different and that you can assume that they don't share a common factor (also obviously you can assume that x<y<z so you don't have to recheck every one of the permutations), so you can skip these numbers for starters, and then you can figure out more restrictions.
It can definitely be optimized, but the point is that brute force isn't a viable option in the first place. Maybe with something GPU-based where you can stream a ludicrous number of simultaneous calculations, but I don't know if that will let you get into 80+ digit (roughly 67+ bit) values with exact precision. OpenCL caps out at 64-bit for integers, or at least used to:
https://stackoverflow.com/questions/6366996/work-with-128bit-or-256bit-unsigned-integers-in-opencl
(Edit: I don't know. I haven't worked with OpenCL. Me enterprise monkey. It sounds like you'd have to implement your own equivalent to BigDecimal/BigInteger around the GPU registers, which starts adding a lot of overhead for packing and unpacking your parameter triad values.)
...and then there's the problem of calculating exact-precision intermediate results. There's a reason the NSA pissed dump trucks full of money into PRISM.
Yeah idk... I've found a bunch of restrictions but it's still pretty huge...
Oh, I forgot some more restrictions: the largest number has to be smaller than 4 times the sum of the other two, but larger than 2.5 times their sum.
Can you do a plot of the first like 20,000 integers?
Alright, I made a plot, and it turned out pretty cool. I had to limit it to something that could be shared, and where you could actually see the detail on a 1080p monitor, so I only did 0-2,000.
Here's the graphs
Every point represents a combination of apple and banana values where it's possible to choose the right pineapple value where you get close to 4. Specifically, where your difference from 4 is less than one part per million. For some combinations, you can pick either a large (in the 1000s) pineapple value, or a small (in the 100s) value. Separating these plots out, apparently you never get a good solution with a small pineapple value when the apple and banana values are too close.
Wish that's super cool, is definitely got a pattern going on. Looks almost like a fractal or interference. Also cool how you can see the linear area where there's no possible solution for pineapple.
Yeah, I kind of thought it was just going to look like static, but I was curious, and it was actually pretty interesting.
I was skeptical at first, because you can get patterns like that in cases like taking a picture of a computer screen, when the pixel grids don't line up, but I checked it at 0-200, when the data points are much larger than the monitor pixels, and the patterns are still there.
Is there a way for you to do a 3d plot? That might show the trends a bit more clearly
So I plotted the large pineapple solutions in 3d, and all of the points are almost perfectly in a plane, there's not much to see there. There's some asymptotic behavior here that means that at this scale, the large pineapple solution will always be close to 4*(apple+banana).
The small pineapple solutions were a little more interesting. They are in two separate planes on either side of the divide in the middle. You can see them here. I also raised the error tolerance to add more scatter points, and you can see that there are similar patterns here, the solutions are just sparser.
Edit: Here is the two solution sets together, for comparison.
Now I'm interested in what's causing those patterns, neat how is the same on both planes
Diofruitine, lmao gottem
I was gonna plot the (real) solution set to the original when I had some time, assuming the macOS Grapher utility can even compute it. Will try sage or something if that doesn’t work.
I’ll ping ya if it’s not a reply to your post
I'd be interested to see it.
I was looking at the work @Pezevenk was doing with lower and upper bounds, and thought that could be used to make the 3d plot more meaningful. His inequalities say that we can iterate the lower and upper bounds with
U_(n+1)=4-1/(1+2*U_n)
L_(n+1)=4-1/(1+2*L_n)-1/L_n
which gives 3.6003 < c/(a+b) < 3.8861
Plotting this value instead of the actual pineapple value effectively exaggerates the deviations from a perfect plane. Now the points are on some kind of a curved 2d surface.
I thought it was interesting that the values only covered about a tenth of the allowed range. The real solution from google is very close to halfway between the bounds, so I would guess that someone could find tighter bounds (no idea how).
I'm not sure what to do with the small pineapple group, since the bounds don't apply to them. Although I suspect that this group might just be some of the same solutions with their variables swapped around.
I also added color to the 2d plots to show which combinations were closer to being solutions than others. I tried plotting the error as the Z-axis, and it just comes out as a cloud of gas. The only time I could see any noticeable pattern was the 2d patterns that you see when looking along the Z-axis
Plots
This is dope. Perhaps I will try to figure out better bounds.
What causes those wave patterns? I took some calculus freshman year, so this is entirely out of my wheelhouse
I really couldn't say. You'd probably need someone at least a little familiar with the analytical way of solving it. I looked at the explanation, and I have no idea how that stuff works.
Until then, pretty shapes!
I'll have to think about how you could show that. Did you have anything in mind?
Are you using Python? I think numpy has a plot function. Been forever since I've used it.
Unless you meant how to plot the equasion...I guess thats not really possible because it's limited by the constant.
I'm using python, but I'm trying to figure out what to actually put on the plot. I was thinking apple value as one axis, banana value as the other, then plotting a scatter of the 1000 or so best combinations that allow you to pick a good pineapple.
Maybe just plot the near misses? Anything within +/- 1 of the goal. Just do a 3d plot with xyz being the variables. Don't know if a scatter plot would be more visible, or a line plot.