Cody

# Problem 166. Kaprekar numbers

Solution 674995

Submitted on 25 May 2015 by Jonathan
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))

y = 495616 k = 3 y = 1111 tf = 0

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

x = 9 tf_correct = 1 y = 81 k = 1 y = 9 tf = 1

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

x = 45 tf_correct = 1 y = 2025 k = 2 y = 45 tf = 1

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

x = 55 tf_correct = 1 y = 3025 k = 2 y = 55 tf = 1

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

x = 99 tf_correct = 1 y = 9801 k = 2 y = 99 tf = 1

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

x = 297 tf_correct = 1 y = 88209 k = 2 y = 297 tf = 1

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

x = 703 tf_correct = 1 y = 494209 k = 3 y = 703 tf = 1

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

x = 999 tf_correct = 1 y = 998001 k = 3 y = 999 tf = 1

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

x = 2223 tf_correct = 1 y = 4941729 k = 3 y = 2223 tf = 1

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

x = 2728 tf_correct = 1 y = 7441984 k = 3 y = 2728 tf = 1

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

x = 4950 tf_correct = 1 y = 24502500 k = 4 y = 4950 tf = 1

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

x = 5050 tf_correct = 1 y = 25502500 k = 4 y = 5050 tf = 1

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

x = 7272 tf_correct = 1 y = 52881984 k = 4 y = 7272 tf = 1

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

x = 7777 tf_correct = 1 y = 60481729 k = 4 y = 7777 tf = 1

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

x = 9999 tf_correct = 1 y = 99980001 k = 4 y = 9999 tf = 1

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

x = 17344 tf_correct = 1 y = 300814336 k = 4 y = 17344 tf = 1

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

x = 22222 tf_correct = 1 y = 493817284 k = 4 y = 22222 tf = 1

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

x = 77778 tf_correct = 1 y = 6049417284 k = 5 y = 77778 tf = 1

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

x = 82656 tf_correct = 1 y = 6832014336 k = 5 y = 82656 tf = 1

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

x = 95121 tf_correct = 1 y = 9048004641 k = 5 y = 95121 tf = 1

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

x = 99999 tf_correct = 1 y = 9999800001 k = 5 y = 99999 tf = 1

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

x = 142857 tf_correct = 1 y = 20408122449 k = 5 y = 142857 tf = 1

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

x = 148149 tf_correct = 1 y = 21948126201 k = 5 y = 148149 tf = 1

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

x = 181819 tf_correct = 1 y = 33058148761 k = 5 y = 181819 tf = 1

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

x = 187110 tf_correct = 1 y = 35010152100 k = 5 y = 187110 tf = 1

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

x = 208495 tf_correct = 1 y = 43470165025 k = 5 y = 208495 tf = 1

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

x = 318682 tf_correct = 1 y = 101558217124 k = 6 y = 318682 tf = 1

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

x = 329967 tf_correct = 1 y = 108878221089 k = 6 y = 329967 tf = 1

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

x = 351352 tf_correct = 1 y = 123448227904 k = 6 y = 351352 tf = 1

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

x = 356643 tf_correct = 1 y = 127194229449 k = 6 y = 356643 tf = 1

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

x = 390313 tf_correct = 1 y = 152344237969 k = 6 y = 390313 tf = 1

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

x = 461539 tf_correct = 1 y = 213018248521 k = 6 y = 461539 tf = 1

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

x = 466830 tf_correct = 1 y = 217930248900 k = 6 y = 466830 tf = 1

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

x = 499500 tf_correct = 1 y = 249500250000 k = 6 y = 499500 tf = 1

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

x = 500500 tf_correct = 1 y = 250500250000 k = 6 y = 500500 tf = 1

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

x = 533170 tf_correct = 1 y = 284270248900 k = 6 y = 533170 tf = 1

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

x = 538461 tf_correct = 1 y = 289940248521 k = 6 y = 538461 tf = 1

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

x = 609687 tf_correct = 1 y = 371718237969 k = 6 y = 609687 tf = 1

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

x = 643357 tf_correct = 1 y = 413908229449 k = 6 y = 643357 tf = 1

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

x = 648648 tf_correct = 1 y = 420744227904 k = 6 y = 648648 tf = 1

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

x = 670033 tf_correct = 1 y = 448944221089 k = 6 y = 670033 tf = 1

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

x = 681318 tf_correct = 1 y = 464194217124 k = 6 y = 681318 tf = 1

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

x = 681319 tf_correct = 0 y = 464195579761 k = 6 y = 1043956 tf = 0

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

x = 681320 tf_correct = 0 y = 464196942400 k = 6 y = 1406596 tf = 0