Cody

# Problem 44497. It's Happy! It's Fun! It's Happy Fun Hyperball!

Solution 1415465

Submitted on 12 Jan 2018 by Tim
• Size: 60
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
x = 1;y_correct = 8; assert(isequal(happy_fun_hyperball(x),y_correct))

2   Pass
x = 2;y_correct = 24; assert(isequal(happy_fun_hyperball(x),y_correct))

3   Pass
tic j=0; for flag=1:1000 j=j+happy_fun_hyperball(flag); end toc j assert(isequal(j,2435870608))

Elapsed time is 1.223448 seconds. j = 2.435870608000000e+09

4   Pass
x = 32767;y_correct = 10393302024; assert(isequal(happy_fun_hyperball(x),y_correct))

5   Pass
x = 32768;y_correct = 24; assert(isequal(happy_fun_hyperball(x),y_correct))

6   Pass
x = 32769;y_correct = 14148064392; assert(isequal(happy_fun_hyperball(x),y_correct))

7   Pass
vals=[18744 82424 95784 85704 4392 183768 68712 92456 26232 95928 98952 146328 1368 103064 118872 137144 20904 177144 84984 139992 9672]; k=ceil(21*rand) assert(isequal(happy_fun_hyperball(99+k),vals(k)))

k = 21

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!