Cody

# Problem 166. Kaprekar numbers

Solution 102278

Submitted on 24 Jun 2012 by MD. MASRUL HUDA
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

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

x = 400 x = 490 x = 495

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

x = 9 tf_correct = 1 x = 8

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

x = 45 tf_correct = 1 x = 20 x = 20

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

x = 55 tf_correct = 1 x = 30 x = 30

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

x = 99 tf_correct = 1 x = 90 x = 98

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

x = 297 tf_correct = 1 x = 80 x = 88

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

x = 703 tf_correct = 1 x = 400 x = 490 x = 494

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

x = 999 tf_correct = 1 x = 900 x = 990 x = 998

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

x = 2223 tf_correct = 1 x = 400 x = 490 x = 494

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

x = 2728 tf_correct = 1 x = 700 x = 740 x = 744

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

x = 4950 tf_correct = 1 x = 2000 x = 2400 x = 2450 x = 2450

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

x = 5050 tf_correct = 1 x = 2000 x = 2500 x = 2550 x = 2550

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

x = 7272 tf_correct = 1 x = 5000 x = 5200 x = 5280 x = 5288

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

x = 7777 tf_correct = 1 x = 6000 x = 6000 x = 6040 x = 6048

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

x = 9999 tf_correct = 1 x = 9000 x = 9900 x = 9990 x = 9998

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

x = 17344 tf_correct = 1 x = 3000 x = 3000 x = 3000 x = 3008

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

x = 22222 tf_correct = 1 x = 4000 x = 4900 x = 4930 x = 4938

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

x = 77778 tf_correct = 1 x = 60000 x = 60000 x = 60400 x = 60490 x = 60494

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

x = 82656 tf_correct = 1 x = 60000 x = 68000 x = 68300 x = 68320 x = 68320

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

x = 95121 tf_correct = 1 x = 90000 x = 90000 x = 90400 x = 90480 x = 90480

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

x = 99999 tf_correct = 1 x = 90000 x = 99000 x = 99900 x = 99990 x = 99998

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

x = 142857 tf_correct = 1 x = 20000 x = 20000 x = 20400 x = 20400 x = 20408

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

x = 148149 tf_correct = 1 x = 20000 x = 21000 x = 21900 x = 21940 x = 21948

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

x = 181819 tf_correct = 1 x = 30000 x = 33000 x = 33000 x = 33050 x = 33058

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

x = 187110 tf_correct = 1 x = 30000 x = 35000 x = 35000 x = 35010 x = 35010

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

x = 208495 tf_correct = 1 x = 40000 x = 43000 x = 43400 x = 43470 x = 43470

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

x = 318682 tf_correct = 1 x = 100000 x = 100000 x = 101000 x = 101500 x = 101550 x = 101558

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

x = 329967 tf_correct = 1 x = 100000 x = 100000 x = 108000 x = 108800 x = 108870 x = 108878

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

x = 351352 tf_correct = 1 x = 100000 x = 120000 x = 123000 x = 123400 x = 123440 x = 123448

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

x = 356643 tf_correct = 1 x = 100000 x = 120000 x = 127000 x = 127100 x = 127190 x = 127194

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

x = 390313 tf_correct = 1 x = 100000 x = 150000 x = 152000 x = 152300 x = 152340 x = 152344

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

x = 461539 tf_correct = 1 x = 200000 x = 210000 x = 213000 x = 213000 x = 213010 x = 213018

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

x = 466830 tf_correct = 1 x = 200000 x = 210000 x = 217000 x = 217900 x = 217930 x = 217930

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

x = 499500 tf_correct = 1 x = 200000 x = 240000 x = 249000 x = 249500 x = 249500 x = 249500

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

x = 500500 tf_correct = 1 x = 200000 x = 250000 x = 250000 x = 250500 x = 250500 x = 250500

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

x = 533170 tf_correct = 1 x = 200000 x = 280000 x = 284000 x = 284200 x = 284270 x = 284270

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

x = 538461 tf_correct = 1 x = 200000 x = 280000 x = 289000 x = 289900 x = 289940 x = 289940

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

x = 609687 tf_correct = 1 x = 300000 x = 370000 x = 371000 x = 371700 x = 371710 x = 371718

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

x = 643357 tf_correct = 1 x = 400000 x = 410000 x = 413000 x = 413900 x = 413900 x = 413908

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

x = 648648 tf_correct = 1 x = 400000 x = 420000 x = 420000 x = 420700 x = 420740 x = 420744

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

x = 670033 tf_correct = 1 x = 400000 x = 440000 x = 448000 x = 448900 x = 448940 x = 448944

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

x = 681318 tf_correct = 1 x = 400000 x = 460000 x = 464000 x = 464100 x = 464190 x = 464194

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

x = 681319 tf_correct = 0 x = 400000 x = 460000 x = 464000 x = 464100 x = 464190 x = 464195

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

x = 681320 tf_correct = 0 x = 400000 x = 460000 x = 464000 x = 464100 x = 464190 x = 464196