Cody

Problem 42836. Juggler sequence revisited

Solution 883628

Submitted on 28 Apr 2016 by Zikobrelli
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 = 3; l_correct = 6; h_correct = 36; [l h] = juggler(x); assert(isequal([l h],[l_correct h_correct]))

i = 0 x = 5 i = 1 h = 5 x = 11 i = 2 h = 11 x = 36 i = 3 h = 36 x = 6 i = 4 h = 36 x = 2 i = 5 h = 36 x = 1 i = 6 h = 36

2   Pass
x = 5; l_correct = 5; h_correct = 36; [l h] = juggler(x); assert(isequal([l h],[l_correct h_correct]))

i = 0 x = 11 i = 1 h = 11 x = 36 i = 2 h = 36 x = 6 i = 3 h = 36 x = 2 i = 4 h = 36 x = 1 i = 5 h = 36

3   Pass
x = 10; l_correct = 7; h_correct = 36; [l h] = juggler(x); assert(isequal([l h],[l_correct h_correct]))

i = 0 x = 3 i = 1 h = 10 x = 5 i = 2 h = 10 x = 11 i = 3 h = 11 x = 36 i = 4 h = 36 x = 6 i = 5 h = 36 x = 2 i = 6 h = 36 x = 1 i = 7 h = 36

4   Pass
x = 77; l_correct = 19; h_correct = 2322378; [l h] = juggler(x); assert(isequal([l h],[l_correct h_correct]))

i = 0 x = 675 i = 1 h = 675 x = 17537 i = 2 h = 17537 x = 2322378 i = 3 h = 2322378 x = 1523 i = 4 h = 2322378 x = 59436 i = 5 h = 2322378 x = 243 i = 6 h = 2322378 x = 3787 i = 7 h = 2322378 x = 233046 i = 8 h = 2322378 x = 482 i = 9 h = 2322378 x = 21 i = 10 h = 2322378 x = 96 i = 11 h = 2322378 x = 9 i = 12 h = 2322378 x = 27 i = 13 h = 2322378 x = 140 i = 14 h = 2322378 x = 11 i = 15 h = 2322378 x = 36 i = 16 h = 2322378 x = 6 i = 17 h = 2322378 x = 2 i = 18 h = 2322378 x = 1 i = 19 h = 2322378

5   Pass
x = 99; l_correct = 11; h_correct = 37754276; [l h] = juggler(x); assert(isequal([l h],[l_correct h_correct]))

i = 0 x = 985 i = 1 h = 985 x = 30913 i = 2 h = 30913 x = 5435152 i = 3 h = 5435152 x = 2331 i = 4 h = 5435152 x = 112541 i = 5 h = 5435152 x = 37754276 i = 6 h = 37754276 x = 6144 i = 7 h = 37754276 x = 78 i = 8 h = 37754276 x = 8 i = 9 h = 37754276 x = 2 i = 10 h = 37754276 x = 1 i = 11 h = 37754276

6   Pass
x = 117; l_correct = 11; h_correct = 44992; [l h] = juggler(x); assert(isequal([l h],[l_correct h_correct]))

i = 0 x = 1265 i = 1 h = 1265 x = 44992 i = 2 h = 44992 x = 212 i = 3 h = 44992 x = 14 i = 4 h = 44992 x = 3 i = 5 h = 44992 x = 5 i = 6 h = 44992 x = 11 i = 7 h = 44992 x = 36 i = 8 h = 44992 x = 6 i = 9 h = 44992 x = 2 i = 10 h = 44992 x = 1 i = 11 h = 44992

7   Pass
x = 1; l_correct = 0; h_correct = 1; [l h] = juggler(x); assert(isequal([l h],[l_correct h_correct]))

i = 0

8   Pass
x = 2; l_correct = 1; h_correct = 2; [l h] = juggler(x); assert(isequal([l h],[l_correct h_correct]))

i = 0 x = 1 i = 1 h = 2

Suggested Problems

More from this Author34

Community Treasure Hunt

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

Start Hunting!