Cody

Problem 166. Kaprekar numbers

Solution 215613

Submitted on 11 Mar 2013
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   Fail
x = 16; tf_correct = false; assert(isequal(kap(x),tf_correct))

ans = 0

Error using VisibleTest1 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

2   Fail
x = 704; tf_correct = false; assert(isequal(kap(x),tf_correct))

ans = 0

Error using VisibleTest2 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

3   Fail
x = 9 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 9 tf_correct = 1 ans = 1

Error using VisibleTest3 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

4   Fail
x = 45 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 45 tf_correct = 1 ans = 1

Error using VisibleTest4 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

5   Fail
x = 55 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 55 tf_correct = 1 ans = 1

Error using VisibleTest5 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

6   Fail
x = 99 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 99 tf_correct = 1 ans = 1

Error using VisibleTest6 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

7   Fail
x = 297 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 297 tf_correct = 1 ans = 1

Error using VisibleTest7 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

8   Fail
x = 703 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 703 tf_correct = 1 ans = 1

Error using VisibleTest8 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

9   Fail
x = 999 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 999 tf_correct = 1 ans = 1

Error using VisibleTest9 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

10   Fail
x = 2223 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 2223 tf_correct = 1 ans = 1

Error using VisibleTest10 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

11   Fail
x = 2728 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 2728 tf_correct = 1 ans = 1

Error using VisibleTest11 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

12   Fail
x = 4950 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 4950 tf_correct = 1 ans = 1

Error using VisibleTest12 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

13   Fail
x = 5050 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 5050 tf_correct = 1 ans = 1

Error using VisibleTest13 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

14   Fail
x = 7272 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 7272 tf_correct = 1 ans = 1

Error using VisibleTest14 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

15   Fail
x = 7777 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 7777 tf_correct = 1 ans = 1

Error using VisibleTest15 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

16   Fail
x = 9999 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 9999 tf_correct = 1 ans = 1

Error using VisibleTest16 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

17   Fail
x = 17344 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 17344 tf_correct = 1 ans = 1

Error using VisibleTest17 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

18   Fail
x = 22222 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 22222 tf_correct = 1 ans = 1

Error using VisibleTest18 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

19   Fail
x = 77778 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 77778 tf_correct = 1 ans = 1

Error using VisibleTest19 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

20   Fail
x = 82656 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 82656 tf_correct = 1 ans = 1

Error using VisibleTest20 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

21   Fail
x = 95121 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 95121 tf_correct = 1 ans = 1

Error using VisibleTest21 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

22   Fail
x = 99999 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 99999 tf_correct = 1 ans = 1

Error using VisibleTest22 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

23   Fail
x = 142857 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 142857 tf_correct = 1 ans = 1

Error using VisibleTest23 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

24   Fail
x = 148149 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 148149 tf_correct = 1 ans = 1

Error using VisibleTest24 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

25   Fail
x = 181819 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 181819 tf_correct = 1 ans = 1

Error using VisibleTest25 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

26   Fail
x = 187110 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 187110 tf_correct = 1 ans = 1

Error using VisibleTest26 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

27   Fail
x = 208495 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 208495 tf_correct = 1 ans = 1

Error using VisibleTest27 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

28   Fail
x = 318682 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 318682 tf_correct = 1 ans = 1

Error using VisibleTest28 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

29   Fail
x = 329967 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 329967 tf_correct = 1 ans = 1

Error using VisibleTest29 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

30   Fail
x = 351352 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 351352 tf_correct = 1 ans = 1

Error using VisibleTest30 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

31   Fail
x = 356643 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 356643 tf_correct = 1 ans = 1

Error using VisibleTest31 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

32   Fail
x = 390313 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 390313 tf_correct = 1 ans = 1

Error using VisibleTest32 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

33   Fail
x = 461539 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 461539 tf_correct = 1 ans = 1

Error using VisibleTest33 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

34   Fail
x = 466830 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 466830 tf_correct = 1 ans = 1

Error using VisibleTest34 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

35   Fail
x = 499500 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 499500 tf_correct = 1 ans = 1

Error using VisibleTest35 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

36   Fail
x = 500500 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 500500 tf_correct = 1 ans = 1

Error using VisibleTest36 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

37   Fail
x = 533170 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 533170 tf_correct = 1 ans = 1

Error using VisibleTest37 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

38   Fail
x = 538461 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 538461 tf_correct = 1 ans = 1

Error using VisibleTest38 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

39   Fail
x = 609687 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 609687 tf_correct = 1 ans = 1

Error using VisibleTest39 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

40   Fail
x = 643357 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 643357 tf_correct = 1 ans = 1

Error using VisibleTest40 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

41   Fail
x = 648648 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 648648 tf_correct = 1 ans = 1

Error using VisibleTest41 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

42   Fail
x = 670033 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 670033 tf_correct = 1 ans = 1

Error using VisibleTest42 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

43   Fail
x = 681318 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 681318 tf_correct = 1 ans = 1

Error using VisibleTest43 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

44   Fail
x = 681319 tf_correct = false assert(isequal(kap(x),tf_correct))

x = 681319 tf_correct = 0 ans = 0

Error using VisibleTest44 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

45   Fail
x = 681320 tf_correct = false assert(isequal(kap(x),tf_correct))

x = 681320 tf_correct = 0 ans = 0

Error using VisibleTest45 (line 3) Output argument "ans" (and maybe others) not assigned during call to "kap".

Suggested Problems

More from this Author23

Community Treasure Hunt

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

Start Hunting!