Cody

Solution 1706990

Submitted on 14 Jan 2019 by Nikolaos Nikolaou
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 = 3276; y_correct = 5; assert(isequal(KaprekarSteps(x),y_correct))

y5 = 7632 y6 = 2367 y7 = 5265 y7 = 3996 i = 2 y = 2 y7 = 6264 i = 3 y = 3 y7 = 4176 i = 4 y = 4 y7 = 6174 i = 5 y = 5

2   Pass
x = 3; y_correct = 6; assert(isequal(KaprekarSteps(x),y_correct))

y1 = 0 0 0 3 y5 = 3000 y6 = 3 y7 = 2997 y7 = 7173 i = 2 y = 2 y7 = 6354 i = 3 y = 3 y7 = 3087 i = 4 y = 4 y7 = 8352 i = 5 y = 5 y7 = 6174 i = 6 y = 6

3   Pass
x = 691; y_correct = 7; assert(isequal(KaprekarSteps(x),y_correct))

y1 = 0 1 6 9 y5 = 9610 y6 = 169 y7 = 9441 y7 = 7992 i = 2 y = 2 y7 = 7173 i = 3 y = 3 y7 = 6354 i = 4 y = 4 y7 = 3087 i = 5 y = 5 y7 = 8352 i = 6 y = 6 y7 = 6174 i = 7 y = 7

4   Pass
x = 3333; y_correct = Inf; assert(isequal(KaprekarSteps(x),y_correct))

y5 = 3333 y6 = 3333 y7 = 0 y = Inf

5   Pass
x = 1; y_correct = 5; assert(isequal(KaprekarSteps(x),y_correct))

y1 = 0 0 0 1 y5 = 1000 y6 = 1 y7 = 999 y1 = 0 9 9 9 y7 = 8991 i = 2 y = 2 y7 = 8082 i = 3 y = 3 y7 = 8532 i = 4 y = 4 y7 = 6174 i = 5 y = 5

6   Pass
x = 6174; y_correct = 0; assert(isequal(KaprekarSteps(x),y_correct))

y = 0

7   Pass
x = 1234; y_correct = 3; assert(isequal(KaprekarSteps(x),y_correct))

y5 = 4321 y6 = 1234 y7 = 3087 y7 = 8352 i = 2 y = 2 y7 = 6174 i = 3 y = 3

8   Pass
x = 3141; y_correct = 5; assert(isequal(KaprekarSteps(x),y_correct))

y5 = 4311 y6 = 1134 y7 = 3177 y7 = 6354 i = 2 y = 2 y7 = 3087 i = 3 y = 3 y7 = 8352 i = 4 y = 4 y7 = 6174 i = 5 y = 5

9   Pass
x = 8080; y_correct = 6; assert(isequal(KaprekarSteps(x),y_correct))

y5 = 8800 y6 = 88 y7 = 8712 y7 = 7443 i = 2 y = 2 y7 = 3996 i = 3 y = 3 y7 = 6264 i = 4 y = 4 y7 = 4176 i = 5 y = 5 y7 = 6174 i = 6 y = 6