Problem 2582. Cut an orange
Perhaps I am misinterpreting, but it seems to me that some of your testsuite solutions are incorrect. For example, for N=5 I seem to be getting 19 instead of 27 cubes entirely within the sphere. I double-check using this code: x=rand(1e6,3); r=sum((x-.5).^2,2)
You are totally right. I've generated answers using my solution, which was wrong. My fault is I haven't examined it any other way. Considering N=5, there could fit inside the sphere only a 3x3x3 cube, but its space diagonal is 3*sqrt(3) which is bigger than 5, the diameter of sphere. So, there cannot be more than 27-8=19 cubes inside. Thanks, for pointing that out, Alfonso!
Fixed & rescored now. It leads now to smaller-size answers. Consider the fact that for some N (for example 6) there are some quasi-cubes containing a very small amount of peel from those ultra-thin-peel-sweet-juicy-ideal-oranges ;-)
Problem Recent Solvers21
Project Euler: Problem 3, Largest prime factor
Given a matrix, swap the 2nd & 3rd columns
Find the sides of an isosceles triangle when given its area and height from its base to apex
More from this Author40
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!