Cody

# Problem 166. Kaprekar numbers

Solution 784005

Submitted on 25 Nov 2015 by Mimutoc
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 = 704; tf_correct = false; assert(isequal(kap(x),tf_correct))

sq1 = 495 sq2 = 616

2   Pass
%% x = 9 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 9 tf_correct = 1 sq1 = 8 sq2 = 1

3   Pass
%% x = 45 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 45 tf_correct = 1 sq1 = 20 sq2 = 25

4   Pass
%% x = 55 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 55 tf_correct = 1 sq1 = 30 sq2 = 25

5   Pass
%% x = 99 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 99 tf_correct = 1 sq1 = 98 sq2 = 01

6   Pass
%% x = 297 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 297 tf_correct = 1 sq1 = 88 sq2 = 209

7   Pass
%% x = 703 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 703 tf_correct = 1 sq1 = 494 sq2 = 209

8   Pass
%% x = 999 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 999 tf_correct = 1 sq1 = 998 sq2 = 001

9   Pass
%% x = 2223 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 2223 tf_correct = 1 sq1 = 494 sq2 = 1729

10   Pass
%% x = 2728 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 2728 tf_correct = 1 sq1 = 744 sq2 = 1984

11   Pass
%% x = 4950 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 4950 tf_correct = 1 sq1 = 2450 sq2 = 2500

12   Pass
%% x = 5050 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 5050 tf_correct = 1 sq1 = 2550 sq2 = 2500

13   Pass
%% x = 7272 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 7272 tf_correct = 1 sq1 = 5288 sq2 = 1984

14   Pass
%% x = 7777 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 7777 tf_correct = 1 sq1 = 6048 sq2 = 1729

15   Pass
%% x = 9999 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 9999 tf_correct = 1 sq1 = 9998 sq2 = 0001

16   Pass
%% x = 17344 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 17344 tf_correct = 1 sq1 = 3008 sq2 = 14336

17   Pass
%% x = 22222 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 22222 tf_correct = 1 sq1 = 4938 sq2 = 17284

18   Pass
%% x = 77778 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 77778 tf_correct = 1 sq1 = 60494 sq2 = 17284

19   Pass
%% x = 82656 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 82656 tf_correct = 1 sq1 = 68320 sq2 = 14336

20   Pass
%% x = 95121 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 95121 tf_correct = 1 sq1 = 90480 sq2 = 04641

21   Pass
%% x = 99999 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 99999 tf_correct = 1 sq1 = 99998 sq2 = 00001

22   Pass
%% x = 142857 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 142857 tf_correct = 1 sq1 = 20408 sq2 = 122449

23   Pass
%% x = 148149 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 148149 tf_correct = 1 sq1 = 21948 sq2 = 126201

24   Pass
%% x = 181819 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 181819 tf_correct = 1 sq1 = 33058 sq2 = 148761

25   Pass
%% x = 187110 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 187110 tf_correct = 1 sq1 = 35010 sq2 = 152100

26   Pass
%% x = 208495 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 208495 tf_correct = 1 sq1 = 43470 sq2 = 165025

27   Pass
%% x = 318682 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 318682 tf_correct = 1 sq1 = 101558 sq2 = 217124

28   Pass
%% x = 329967 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 329967 tf_correct = 1 sq1 = 108878 sq2 = 221089

29   Pass
%% x = 351352 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 351352 tf_correct = 1 sq1 = 123448 sq2 = 227904

30   Pass
%% x = 356643 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 356643 tf_correct = 1 sq1 = 127194 sq2 = 229449

31   Pass
%% x = 390313 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 390313 tf_correct = 1 sq1 = 152344 sq2 = 237969

32   Pass
%% x = 461539 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 461539 tf_correct = 1 sq1 = 213018 sq2 = 248521

33   Pass
%% x = 466830 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 466830 tf_correct = 1 sq1 = 217930 sq2 = 248900

34   Pass
%% x = 499500 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 499500 tf_correct = 1 sq1 = 249500 sq2 = 250000

35   Pass
%% x = 500500 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 500500 tf_correct = 1 sq1 = 250500 sq2 = 250000

36   Pass
%% x = 533170 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 533170 tf_correct = 1 sq1 = 284270 sq2 = 248900

37   Pass
%% x = 538461 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 538461 tf_correct = 1 sq1 = 289940 sq2 = 248521

38   Pass
%% x = 609687 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 609687 tf_correct = 1 sq1 = 371718 sq2 = 237969

39   Pass
%% x = 643357 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 643357 tf_correct = 1 sq1 = 413908 sq2 = 229449

40   Pass
%% x = 648648 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 648648 tf_correct = 1 sq1 = 420744 sq2 = 227904

41   Pass
%% x = 670033 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 670033 tf_correct = 1 sq1 = 448944 sq2 = 221089

42   Pass
%% x = 681318 tf_correct = true assert(isequal(kap(x),tf_correct))

x = 681318 tf_correct = 1 sq1 = 464194 sq2 = 217124

43   Pass
%% x = 681319 tf_correct = false assert(isequal(kap(x),tf_correct))

x = 681319 tf_correct = 0 sq1 = 464195 sq2 = 579761

44   Pass
%% x = 681320 tf_correct = false assert(isequal(kap(x),tf_correct))

x = 681320 tf_correct = 0 sq1 = 464196 sq2 = 942400