Yes, it's Happy Fun Hyperball! The CODY sensation that's sweeping MATLAB nation! All you need to do to get your free Happy Fun Hyperball is write a script that, when given a radius r, will tell us how many points with all integer coordinates are on the surface of your four-dimensional shape (defined by w^2+x^2+y^2+z^2=r^2) known as Happy Fun Hyperball! For example, if r=2, you will have 24 of these points:
* (+/-2),0,0,0 * 0,(+/-2),0,0 * 0,0,(+/-2),0 * 0,0,0,(+/-2) * (+/-1),(+/-1),(+/-1),(+/-1)
so happy_fun_hyperball(2)=24. Good luck!
* itching * vertigo * dizziness * tingling in extremities * loss of balance or coordination * slurred speech * temporary blindness * profuse sweating * or heart palpitations.
Happy Fun Hyperball comes with a lifetime warranty. Happy Fun Hyperball! Accept no substitutes!
Hello, James & all. What a happy Problem! There are a few details I am not getting and would appreciate clarifications on:
***Summation of enumerated cases*** In the example there are fourteen occurrences of "±". Wouldn't that provide a total of 28 distinct points in space (instead of 24)? That is, 2 for each of the first four bullets, and 4 for each of the last five bullets? ***Enumeration of cases*** Following the pattern in the example, I would have expected one additional bullet comprising (±1,0,0,±1). That would suggest happy_fun_hyperball(2)=32. ***Points "on" surface*** If points are to be "on" the surface, then can (±1,±1,0,0) qualify for r=2? Given this has the third and fourth variables set to zero, then shouldn't (±1,±1,0,0) also be "on" the circle of r=2 in the x–y plane? Yet (1,1) is a distance of √2 from the origin. So then could happy_fun_hyperball(2)=8?
Thanks, David
The 24 solutions for r=2 are actually [-2 0 0 0;-1 -1 -1 -1;-1 -1 -1 1;-1 -1 1 -1;-1 -1 1 1;-1 1 -1 -1;-1 1 -1 1;-1 1 1 -1;-1 1 1 1;0 -2 0 0;0 0 -2 0;0 0 0 -2;0 0 0 2;0 0 2 0;0 2 0 0;1 -1 -1 -1;1 -1 -1 1;1 -1 1 -1;1 -1 1 1;1 1 -1 -1;1 1 -1 1;1 1 1 -1;1 1 1 1;2 0 0 0].
Aahaa... Thank-you for the explanation, Tim. Actually it was quite simple when looking at the correct numbers. So we could also summarise it as four similar patterns (±2,0,0,0), (0,±2,0,0), (0,0,±2,0) and (0,0,0,±2) accounting for 4×2=8 points, and one more pattern (±1,±1,±1,±1) accounting for 1×2⁴=16 points. Thus a grand total of 24 points. —DIV
I originally had the points for w^2+x^2+y^2+z^2=r, as opposed to r^2. Sorry for the confusion, David...and thanks for taking care of the clarification, Tim!
They're fixed now, and the problem statement has been changed a bit to hopefully clear things up.
159 Solvers
Change a specific color in an image
42 Solvers
Get the elements of diagonal and antidiagonal for any m-by-n matrix
196 Solvers
Penny Flipping: Reverse subsets of a sequence of coins until you recover the original configuration
8 Solvers
Lychrel Number Test (Inspired by Project Euler Problem 55)
45 Solvers