Cody

# Problem 166. Kaprekar numbers

Solution 2630212

Submitted on 29 Jun 2020 by Ramesh Kumar V
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 = 16; tf_correct = false; assert(isequal(kap(x),tf_correct))

a = 256 k = 0 sum = 0 c = 0 k = 1 m = 6 sum = 6 c = 1 a = 25 k = 2 m = 6 5 sum = 11 c = 2 a = 2 k = 3 m = 6 5 2 sum = 13 c = 3 a = 0 b = 2 5 6 n = 1 x1 = 2 x2 = 5 6 x1 = 2 lenx1 = 1 x2 = 5 6 lenx2 = 2 sum11 = 0 sum11 = 2 sum22 = 0 sum22 = 50 sum22 = 56 num = 58 b = logical 0

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

a = 495616 k = 0 sum = 0 c = 0 k = 1 m = 6 sum = 6 c = 1 a = 49561 k = 2 m = 6 1 sum = 7 c = 2 a = 4956 k = 3 m = 6 1 6 sum = 13 c = 3 a = 495 k = 4 m = 6 1 6 5 sum = 18 c = 4 a = 49 k = 5 m = 6 1 6 5 9 sum = 27 c = 5 a = 4 k = 6 m = 6 1 6 5 9 4 sum = 31 c = 6 a = 0 b = 4 9 5 6 1 6 n = 0 x1 = 4 9 5 x2 = 6 1 6 x1 = 4 9 5 lenx1 = 3 x2 = 6 1 6 lenx2 = 3 sum11 = 0 sum11 = 400 sum11 = 490 sum11 = 495 sum22 = 0 sum22 = 600 sum22 = 610 sum22 = 616 num = 1111 b = logical 0

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

x = 9 tf_correct = logical 1 a = 81 k = 0 sum = 0 c = 0 k = 1 m = 1 sum = 1 c = 1 a = 8 k = 2 m = 1 8 sum = 9 c = 2 a = 0 b = 8 1 n = 0 x1 = 8 x2 = 1 x1 = 8 lenx1 = 1 x2 = 1 lenx2 = 1 sum11 = 0 sum11 = 8 sum22 = 0 sum22 = 1 num = 9 b = logical 1

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

x = 45 tf_correct = logical 1 a = 2025 k = 0 sum = 0 c = 0 k = 1 m = 5 sum = 5 c = 1 a = 202 k = 2 m = 5 2 sum = 7 c = 2 a = 20 k = 3 m = 5 2 0 sum = 7 c = 3 a = 2 k = 4 m = 5 2 0 2 sum = 9 c = 4 a = 0 b = 2 0 2 5 n = 0 x1 = 2 0 x2 = 2 5 x1 = 2 0 lenx1 = 2 x2 = 2 5 lenx2 = 2 sum11 = 0 sum11 = 20 sum11 = 20 sum22 = 0 sum22 = 20 sum22 = 25 num = 45 b = logical 1

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

x = 55 tf_correct = logical 1 a = 3025 k = 0 sum = 0 c = 0 k = 1 m = 5 sum = 5 c = 1 a = 302 k = 2 m = 5 2 sum = 7 c = 2 a = 30 k = 3 m = 5 2 0 sum = 7 c = 3 a = 3 k = 4 m = 5 2 0 3 sum = 10 c = 4 a = 0 b = 3 0 2 5 n = 0 x1 = 3 0 x2 = 2 5 x1 = 3 0 lenx1 = 2 x2 = 2 5 lenx2 = 2 sum11 = 0 sum11 = 30 sum11 = 30 sum22 = 0 sum22 = 20 sum22 = 25 num = 55 b = logical 1

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

x = 99 tf_correct = logical 1 a = 9801 k = 0 sum = 0 c = 0 k = 1 m = 1 sum = 1 c = 1 a = 980 k = 2 m = 1 0 sum = 1 c = 2 a = 98 k = 3 m = 1 0 8 sum = 9 c = 3 a = 9 k = 4 m = 1 0 8 9 sum = 18 c = 4 a = 0 b = 9 8 0 1 n = 0 x1 = 9 8 x2 = 0 1 x1 = 9 8 lenx1 = 2 x2 = 0 1 lenx2 = 2 sum11 = 0 sum11 = 90 sum11 = 98 sum22 = 0 sum22 = 0 sum22 = 1 num = 99 b = logical 1

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

x = 297 tf_correct = logical 1 a = 88209 k = 0 sum = 0 c = 0 k = 1 m = 9 sum = 9 c = 1 a = 8820 k = 2 m = 9 0 sum = 9 c = 2 a = 882 k = 3 m = 9 0 2 sum = 11 c = 3 a = 88 k = 4 m = 9 0 2 8 sum = 19 c = 4 a = 8 k = 5 m = 9 0 2 8 8 sum = 27 c = 5 a = 0 b = 8 8 2 0 9 n = 1 x1 = 8 8 x2 = 2 0 9 x1 = 8 8 lenx1 = 2 x2 = 2 0 9 lenx2 = 3 sum11 = 0 sum11 = 80 sum11 = 88 sum22 = 0 sum22 = 200 sum22 = 200 sum22 = 209 num = 297 b = logical 1

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

x = 703 tf_correct = logical 1 a = 494209 k = 0 sum = 0 c = 0 k = 1 m = 9 sum = 9 c = 1 a = 49420 k = 2 m = 9 0 sum = 9 c = 2 a = 4942 k = 3 m = 9 0 2 sum = 11 c = 3 a = 494 k = 4 m = 9 0 2 4 sum = 15 c = 4 a = 49 k = 5 m = 9 0 2 4 9 sum = 24 c = 5 a = 4 k = 6 m = 9 0 2 4 9 4 sum = 28 c = 6 a = 0 b = 4 9 4 2 0 9 n = 0 x1 = 4 9 4 x2 = 2 0 9 x1 = 4 9 4 lenx1 = 3 x2 = 2 0 9 lenx2 = 3 sum11 = 0 sum11 = 400 sum11 = 490 sum11 = 494 sum22 = 0 sum22 = 200 sum22 = 200 sum22 = 209 num = 703 b = logical 1

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

x = 999 tf_correct = logical 1 a = 998001 k = 0 sum = 0 c = 0 k = 1 m = 1 sum = 1 c = 1 a = 99800 k = 2 m = 1 0 sum = 1 c = 2 a = 9980 k = 3 m = 1 0 0 sum = 1 c = 3 a = 998 k = 4 m = 1 0 0 8 sum = 9 c = 4 a = 99 k = 5 m = 1 0 0 8 9 sum = 18 c = 5 a = 9 k = 6 m = 1 0 0 8 9 9 sum = 27 c = 6 a = 0 b = 9 9 8 0 0 1 n = 0 x1 = 9 9 8 x2 = 0 0 1 x1 = 9 9 8 lenx1 = 3 x2 = 0 0 1 lenx2 = 3 sum11 = 0 sum11 = 900 sum11 = 990 sum11 = 998 sum22 = 0 sum22 = 0 sum22 = 0 sum22 = 1 num = 999 b = logical 1

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

x = 2223 tf_correct = logical 1 a = 4941729 k = 0 sum = 0 c = 0 k = 1 m = 9 sum = 9 c = 1 a = 494172 k = 2 m = 9 2 sum = 11 c = 2 a = 49417 k = 3 m = 9 2 7 sum = 18 c = 3 a = 4941 k = 4 m = 9 2 7 1 sum = 19 c = 4 a = 494 k = 5 m = 9 2 7 1 4 sum = 23 c = 5 a = 49 k = 6 m = 9 2 7 1 4 9 sum = 32 c = 6 a = 4 k = 7 m = 9 2 7 1 4 9 4 sum = 36 c = 7 a = 0 b = 4 9 4 1 7 2 9 n = 1 x1 = 4 9 4 x2 = 1 7 2 9 x1 = 4 9 4 lenx1 = 3 x2 = 1 7 2 9 lenx2 = 4 sum11 = 0 sum11 = 400 sum11 = 490 sum11 = 494 sum22 = 0 sum22 = 1000 sum22 = 1700 sum22 = 1720 sum22 = 1729 num = 2223 b = logical 1

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

x = 2728 tf_correct = logical 1 a = 7441984 k = 0 sum = 0 c = 0 k = 1 m = 4 sum = 4 c = 1 a = 744198 k = 2 m = 4 8 sum = 12 c = 2 a = 74419 k = 3 m = 4 8 9 sum = 21 c = 3 a = 7441 k = 4 m = 4 8 9 1 sum = 22 c = 4 a = 744 k = 5 m = 4 8 9 1 4 sum = 26 c = 5 a = 74 k = 6 m = 4 8 9 1 4 4 sum = 30 c = 6 a = 7 k = 7 m = 4 8 9 1 4 4 7 sum = 37 c = 7 a = 0 b = 7 4 4 1 9 8 4 n = 1 x1 = 7 4 4 x2 = 1 9 8 4 x1 = 7 4 4 lenx1 = 3 x2 = 1 9 8 4 lenx2 = 4 sum11 = 0 sum11 = 700 sum11 = 740 sum11 = 744 sum22 = 0 sum22 = 1000 sum22 = 1900 sum22 = 1980 sum22 = 1984 num = 2728 b = logical 1

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

x = 4950 tf_correct = logical 1 a = 24502500 k = 0 sum = 0 c = 0 k = 1 m = 0 sum = 0 c = 1 a = 2450250 k = 2 m = 0 0 sum = 0 c = 2 a = 245025 k = 3 m = 0 0 5 sum = 5 c = 3 a = 24502 k = 4 m = 0 0 5 2 sum = 7 c = 4 a = 2450 k = 5 m = 0 0 5 2 0 sum = 7 c = 5 a = 245 k = 6 m = 0 0 5 2 0 5 sum = 12 c = 6 a = 24 k = 7 m = 0 0 5 2 0 5 4 sum = 16 c = 7 a = 2 k = 8 m = 0 0 5 2 0 5 4 2 sum = 18 c = 8 a = 0 b = 2 4 5 0 2 5 0 0 n = 0 x1 = 2 4 5 0 x2 = 2 5 0 0 x1 = 2 4 5 0 lenx1 = 4 x2 = 2 5 0 0 lenx2 = 4 sum11 = 0 sum11 = 2000 sum11 = 2400 sum11 = 2450 sum11 = 2450 sum22 = 0 sum22 = 2000 sum22 = 2500 sum22 = 2500 sum22 = 2500 num = 4950 b = logical 1

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

x = 5050 tf_correct = logical 1 a = 25502500 k = 0 sum = 0 c = 0 k = 1 m = 0 sum = 0 c = 1 a = 2550250 k = 2 m = 0 0 sum = 0 c = 2 a = 255025 k = 3 m = 0 0 5 sum = 5 c = 3 a = 25502 k = 4 m = 0 0 5 2 sum = 7 c = 4 a = 2550 k = 5 m = 0 0 5 2 0 sum = 7 c = 5 a = 255 k = 6 m = 0 0 5 2 0 5 sum = 12 c = 6 a = 25 k = 7 m = 0 0 5 2 0 5 5 sum = 17 c = 7 a = 2 k = 8 m = 0 0 5 2 0 5 5 2 sum = 19 c = 8 a = 0 b = 2 5 5 0 2 5 0 0 n = 0 x1 = 2 5 5 0 x2 = 2 5 0 0 x1 = 2 5 5 0 lenx1 = 4 x2 = 2 5 0 0 lenx2 = 4 sum11 = 0 sum11 = 2000 sum11 = 2500 sum11 = 2550 sum11 = 2550 sum22 = 0 sum22 = 2000 sum22 = 2500 sum22 = 2500 sum22 = 2500 num = 5050 b = logical 1

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

x = 7272 tf_correct = logical 1 a = 52881984 k = 0 sum = 0 c = 0 k = 1 m = 4 sum = 4 c = 1 a = 5288198 k = 2 m = 4 8 sum = 12 c = 2 a = 528819 k = 3 m = 4 8 9 sum = 21 c = 3 a = 52881 k = 4 m = 4 8 9 1 sum = 22 c = 4 a = 5288 k = 5 m = 4 8 9 1 8 sum = 30 c = 5 a = 528 k = 6 m = 4 8 9 1 8 8 sum = 38 c = 6 a = 52 k = 7 m = 4 8 9 1 8 8 2 sum = 40 c = 7 a = 5 k = 8 m = 4 8 9 1 8 8 2 5 sum = 45 c = 8 a = 0 b = 5 2 8 8 1 9 8 4 n = 0 x1 = 5 2 8 8 x2 = 1 9 8 4 x1 = 5 2 8 8 lenx1 = 4 x2 = 1 9 8 4 lenx2 = 4 sum11 = 0 sum11 = 5000 sum11 = 5200 sum11 = 5280 sum11 = 5288 sum22 = 0 sum22 = 1000 sum22 = 1900 sum22 = 1980 sum22 = 1984 num = 7272 b = logical 1

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

x = 7777 tf_correct = logical 1 a = 60481729 k = 0 sum = 0 c = 0 k = 1 m = 9 sum = 9 c = 1 a = 6048172 k = 2 m = 9 2 sum = 11 c = 2 a = 604817 k = 3 m = 9 2 7 sum = 18 c = 3 a = 60481 k = 4 m = 9 2 7 1 sum = 19 c = 4 a = 6048 k = 5 m = 9 2 7 1 8 sum = 27 c = 5 a = 604 k = 6 m = 9 2 7 1 8 4 sum = 31 c = 6 a = 60 k = 7 m = 9 2 7 1 8 4 0 sum = 31 c = 7 a = 6 k = 8 m = 9 2 7 1 8 4 0 6 sum = 37 c = 8 a = 0 b = 6 0 4 8 1 7 2 9 n = 0 x1 = 6 0 4 8 x2 = 1 7 2 9 x1 = 6 0 4 8 lenx1 = 4 x2 = 1 7 2 9 lenx2 = 4 sum11 = 0 sum11 = 6000 sum11 = 6000 sum11 = 6040 sum11 = 6048 sum22 = 0 sum22 = 1000 sum22 = 1700 sum22 = 1720 sum22 = 1729 num = 7777 b = logical 1

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

x = 9999 tf_correct = logical 1 a = 99980001 k = 0 sum = 0 c = 0 k = 1 m = 1 sum = 1 c = 1 a = 9998000 k = 2 m = 1 0 sum = 1 c = 2 a = 999800 k = 3 m = 1 0 0 sum = 1 c = 3 a = 99980 k = 4 m = 1 0 0 0 sum = 1 c = 4 a = 9998 k = 5 m = 1 0 0 0 8 sum = 9 c = 5 a = 999 k = 6 m = 1 0 0 0 8 9 sum = 18 c = 6 a = 99 k = 7 m = 1 0 0 0 8 9 9 sum = 27 c = 7 a = 9 k = 8 m = 1 0 0 0 8 9 9 9 sum = 36 c = 8 a = 0 b = 9 9 9 8 0 0 0 1 n = 0 x1 = 9 9 9 8 x2 = 0 0 0 1 x1 = 9 9 9 8 lenx1 = 4 x2 = 0 0 0 1 lenx2 = 4 sum11 = 0 sum11 = 9000 sum11 = 9900 sum11 = 9990 sum11 = 9998 sum22 = 0 sum22 = 0 sum22 = 0 sum22 = 0 sum22 = 1 num = 9999 b = logical 1

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

x = 17344 tf_correct = logical 1 a = 300814336 k = 0 sum = 0 c = 0 k = 1 m = 6 sum = 6 c = 1 a = 30081433 k = 2 m = 6 3 sum = 9 c = 2 a = 3008143 k = 3 m = 6 3 3 sum = 12 c = 3 a = 300814 k = 4 m = 6 3 3 4 sum = 16 c = 4 a = 30081 k = 5 m = 6 3 3 4 1 sum = 17 c = 5 a = 3008 k = 6 m = 6 3 3 4 1 8 sum = 25 c = 6 a = 300 k = 7 m = 6 3 3 4 1 8 0 sum = 25 c = 7 a = 30 k = 8 m = 6 3 3 4 1 8 0 0 sum = 25 c = 8 a = 3 k = 9 m = 6 3 3 4 1 8 0 0 3 sum = 28 c = 9 a = 0 b = 3 0 0 8 1 4 3 3 6 n = 1 x1 = 3 0 0 8 x2 = 1 4 3 3 6 x1 = 3 0 0 8 lenx1 = 4 x2 = 1 4 3 3 6 lenx2 = 5 sum11 = 0 sum11 = 3000 sum11 = 3000 sum11 = 3000 sum11 = 3008 sum22 = 0 sum22 = 10000 sum22 = 14000 sum22 = 14300 sum22 = 14330 sum22 = 14336 num = 17344 b = logical 1

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

x = 22222 tf_correct = logical 1 a = 493817284 k = 0 sum = 0 c = 0 k = 1 m = 4 sum = 4 c = 1 a = 49381728 k = 2 m = 4 8 sum = 12 c = 2 a = 4938172 k = 3 m = 4 8 2 sum = 14 c = 3 a = 493817 k = 4 m = 4 8 2 7 sum = 21 c = 4 a = 49381 k = 5 m = 4 8 2 7 1 sum = 22 c = 5 a = 4938 k = 6 m = 4 8 2 7 1 8 sum = 30 c = 6 a = 493 k = 7 m = 4 8 2 7 1 8 3 sum = 33 c = 7 a = 49 k = 8 m = 4 8 2 7 1 8 3 9 sum = 42 c = 8 a = 4 k = 9 m = 4 8 2 7 1 8 3 9 4 sum = 46 c = 9 a = 0 b = 4 9 3 8 1 7 2 8 4 n = 1 x1 = 4 9 3 8 x2 = 1 7 2 8 4 x1 = 4 9 3 8 lenx1 = 4 x2 = 1 7 2 8 4 lenx2 = 5 sum11 = 0 sum11 = 4000 sum11 = 4900 sum11 = 4930 sum11 = 4938 sum22 = 0 sum22 = 10000 sum22 = 17000 sum22 = 17200 sum22 = 17280 sum22 = 17284 num = 22222 b = logical 1

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

x = 77778 tf_correct = logical 1 a = 6.0494e+09 k = 0 sum = 0 c = 0 k = 1 m = 4 sum = 4 c = 1 a = 604941728 k = 2 m = 4 8 sum = 12 c = 2 a = 60494172 k = 3 m = 4 8 2 sum = 14 c = 3 a = 6049417 k = 4 m = 4 8 2 7 sum = 21 c = 4 a = 604941 k = 5 m = 4 8 2 7 1 sum = 22 c = 5 a = 60494 k = 6 m = 4 8 2 7 1 4 sum = 26 c = 6 a = 6049 k = 7 m = 4 8 2 7 1 4 9 sum = 35 c = 7 a = 604 k = 8 m = 4 8 2 7 1 4 9 4 sum = 39 c = 8 a = 60 k = 9 m = 4 8 2 7 1 4 9 4 0 sum = 39 c = 9 a = 6 k = 10 m = 4 8 2 7 1 4 9 4 0 6 sum = 45 c = 10 a = 0 b = 6 0 4 9 4 1 7 2 8 4 n = 0 x1 = 6 0 4 9 4 x2 = 1 7 2 8 4 x1 = 6 0 4 9 4 lenx1 = 5 x2 = 1 7 2 8 4 lenx2 = 5 sum11 = 0 sum11 = 60000 sum11 = 60000 sum11 = 60400 sum11 = 60490 sum11 = 60494 sum22 = 0 sum22 = 10000 sum22 = 17000 sum22 = 17200 sum22 = 17280 sum22 = 17284 num = 77778 b = logical 1

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

x = 82656 tf_correct = logical 1 a = 6.8320e+09 k = 0 sum = 0 c = 0 k = 1 m = 6 sum = 6 c = 1 a = 683201433 k = 2 m = 6 3 sum = 9 c = 2 a = 68320143 k = 3 m = 6 3 3 sum = 12 c = 3 a = 6832014 k = 4 m = 6 3 3 4 sum = 16 c = 4 a = 683201 k = 5 m = 6 3 3 4 1 sum = 17 c = 5 a = 68320 k = 6 m = 6 3 3 4 1 0 sum = 17 c = 6 a = 6832 k = 7 m = 6 3 3 4 1 0 2 sum = 19 c = 7 a = 683 k = 8 m = 6 3 3 4 1 0 2 3 sum = 22 c = 8 a = 68 k = 9 m = 6 3 3 4 1 0 2 3 8 sum = 30 c = 9 a = 6 k = 10 m = 6 3 3 4 1 0 2 3 8 6 sum = 36 c = 10 a = 0 b = 6 8 3 2 0 1 4 3 3 6 n = 0 x1 = 6 8 3 2 0 x2 = 1 4 3 3 6 x1 = 6 8 3 2 0 lenx1 = 5 x2 = 1 4 3 3 6 lenx2 = 5 sum11 = 0 sum11 = 60000 sum11 = 68000 sum11 = 68300 sum11 = 68320 sum11 = 68320 sum22 = 0 sum22 = 10000 sum22 = 14000 sum22 = 14300 sum22 = 14330 sum22 = 14336 num = 82656 b = logical 1

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

x = 95121 tf_correct = logical 1 a = 9.0480e+09 k = 0 sum = 0 c = 0 k = 1 m = 1 sum = 1 c = 1 a = 904800464 k = 2 m = 1 4 sum = 5 c = 2 a = 90480046 k = 3 m = 1 4 6 sum = 11 c = 3 a = 9048004 k = 4 m = 1 4 6 4 sum = 15 c = 4 a = 904800 k = 5 m = 1 4 6 4 0 sum = 15 c = 5 a = 90480 k = 6 m = 1 4 6 4 0 0 sum = 15 c = 6 a = 9048 k = 7 m = 1 4 6 4 0 0 8 sum = 23 c = 7 a = 904 k = 8 m = 1 4 6 4 0 0 8 4 sum = 27 c = 8 a = 90 k = 9 m = 1 4 6 4 0 0 8 4 0 sum = 27 c = 9 a = 9 k = 10 m = 1 4 6 4 0 0 8 4 0 9 sum = 36 c = 10 a = 0 b = 9 0 4 8 0 0 4 6 4 1 n = 0 x1 = 9 0 4 8 0 x2 = 0 4 6 4 1 x1 = 9 0 4 8 0 lenx1 = 5 x2 = 0 4 6 4 1 lenx2 = 5 sum11 = 0 sum11 = 90000 sum11 = 90000 sum11 = 90400 sum11 = 90480 sum11 = 90480 sum22 = 0 sum22 = 0 sum22 = 4000 sum22 = 4600 sum22 = 4640 sum22 = 4641 num = 95121 b = logical 1

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

x = 99999 tf_correct = logical 1 a = 9.9998e+09 k = 0 sum = 0 c = 0 k = 1 m = 1 sum = 1 c = 1 a = 999980000 k = 2 m = 1 0 sum = 1 c = 2 a = 99998000 k = 3 m = 1 0 0 sum = 1 c = 3 a = 9999800 k = 4 m = 1 0 0 0 sum = 1 c = 4 a = 999980 k = 5 m = 1 0 0 0 0 sum = 1 c = 5 a = 99998 k = 6 m = 1 0 0 0 0 8 sum = 9 c = 6 a = 9999 k = 7 m = 1 0 0 0 0 8 9 sum = 18 c = 7 a = 999 k = 8 m = 1 0 0 0 0 8 9 9 sum = 27 c = 8 a = 99 k = 9 m = 1 0 0 0 0 8 9 9 9 sum = 36 c = 9 a = 9 k = 10 m = 1 0 0 0 0 8 9 9 9 9 sum = 45 c = 10 a = 0 b = 9 9 9 9 8 0 0 0 0 1 n = 0 x1 = 9 9 9 9 8 x2 = 0 0 0 0 1 x1 = 9 9 9 9 8 lenx1 = 5 x2 = 0 0 0 0 1 lenx2 = 5 sum11 = 0 sum11 = 90000 sum11 = 99000 sum11 = 99900 sum11 = 99990 sum11 = 99998 sum22 = 0 sum22 = 0 sum22 = 0 sum22 = 0 sum22 = 0 sum22 = 1 num = 99999 b = logical 1

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

x = 142857 tf_correct = logical 1 a = 2.0408e+10 k = 0 sum = 0 c = 0 k = 1 m = 9 sum = 9 c = 1 a = 2.0408e+09 k = 2 m = 9 4 sum = 13 c = 2 a = 204081224 k = 3 m = 9 4 4 sum = 17 c = 3 a = 20408122 k = 4 m = 9 4 4 2 sum = 19 c = 4 a = 2040812 k = 5 m = 9 4 4 2 2 sum = 21 c = 5 a = 204081 k = 6 m = 9 4 4 2 2 1 sum = 22 c = 6 a = 20408 k = 7 m = 9 4 4 2 2 1 8 sum = 30 c = 7 a = 2040 k = 8 m = 9 4 4 2 2 1 8 0 sum = 30 c = 8 a = 204 k = 9 m = 9 4 4 2 2 1 8 0 4 sum = 34 c = 9 a = 20 k = 10 m = 9 4 4 2 2 1 8 0 4 0 sum = 34 c = 10 a = 2 k = 11 m = 9 4 4 2 2 1 8 0 4 0 2 sum = 36 c = 11 a = 0 b = 2 0 4 0 8 1 2 2 4 4 9 n = 1 x1 = 2 0 4 0 8 x2 = 1 2 2 4 4 9 x1 = 2 0 4 0 8 lenx1 = 5 x2 = 1 2 2 4 4 9 lenx2 = 6 sum11 = 0 sum11 = 20000 sum11 = 20000 sum11 = 20400 sum11 = 20400 sum11 = 20408 sum22 = 0 sum22 = 100000 sum22 = 120000 sum22 = 122000 sum22 = 122400 sum22 = 122440 sum22 = 122449 num = 142857 b = logical 1

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

x = 148149 tf_correct = logical 1 a = 2.1948e+10 k = 0 sum = 0 c = 0 k = 1 m = 1 sum = 1 c = 1 a = 2.1948e+09 k = 2 m = 1 0 sum = 1 c = 2 a = 219481262 k = 3 m = 1 0 2 sum = 3 c = 3 a = 21948126 k = 4 m = 1 0 2 6 sum = 9 c = 4 a = 2194812 k = 5 m = 1 0 2 6 2 sum = 11 c = 5 a = 219481 k = 6 m = 1 0 2 6 2 1 sum = 12 c = 6 a = 21948 k = 7 m = 1 0 2 6 2 1 8 sum = 20 c = 7 a = 2194 k = 8 m = 1 0 2 6 2 1 8 4 sum = 24 c = 8 a = 219 k = 9 m = 1 0 2 6 2 1 8 4 9 sum = 33 c = 9 a = 21 k = 10 m = 1 0 2 6 2 1 8 4 9 1 sum = 34 c = 10 a = 2 k = 11 m = 1 0 2 6 2 1 8 4 9 1 2 sum = 36 c = 11 a = 0 b = 2 1 9 4 8 1 2 6 2 0 1 n = 1 x1 = 2 1 9 4 8 x2 = 1 2 6 2 0 1 x1 = 2 1 9 4 8 lenx1 = 5 x2 = 1 2 6 2 0 1 lenx2 = 6 sum11 = 0 sum11 = 20000 sum11 = 21000 sum11 = 21900 sum11 = 21940 sum11 = 21948 sum22 = 0 sum22 = 100000 sum22 = 120000 sum22 = 126000 sum22 = 126200 sum22 = 126200 sum22 = 126201 num = 148149 b = logical 1

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

x = 181819 tf_correct = logical 1 a = 3.3058e+10 k = 0 sum = 0 c = 0 k = 1 m = 1 sum = 1 c = 1 a = 3.3058e+09 k = 2 m = 1 6 sum = 7 c = 2 a = 330581487 k = 3 m = 1 6 7 sum = 14 c = 3 a = 33058148 k = 4 m = 1 6 7 8 sum = 22 c = 4 a = 3305814 k = 5 m = 1 6 7 8 4 sum = 26 c = 5 a = 330581 k = 6 m = 1 6 7 8 4 1 sum = 27 c = 6 a = 33058 k = 7 m = 1 6 7 8 4 1 8 sum = 35 c = 7 a = 3305 k = 8 m = 1 6 7 8 4 1 8 5 sum = 40 c = 8 a = 330 k = 9 m = 1 6 7 8 4 1 8 5 0 sum = 40 c = 9 a = 33 k = 10 m = 1 6 7 8 4 1 8 5 0 3 sum = 43 c = 10 a = 3 k = 11 m = 1 6 7 8 4 1 8 5 0 3 3 sum = 46 c = 11 a = 0 b = 3 3 0 5 8 1 4 8 7 6 1 n = 1 x1 = 3 3 0 5 8 x2 = 1 4 8 7 6 1 x1 = 3 3 0 5 8 lenx1 = 5 x2 = 1 4 8 7 6 1 lenx2 = 6 sum11 = 0 sum11 = 30000 sum11 = 33000 sum11 = 33000 sum11 = 33050 sum11 = 33058 sum22 = 0 sum22 = 100000 sum22 = 140000 sum22 = 148000 sum22 = 148700 sum22 = 148760 sum22 = 148761 num = 181819 b = logical 1

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

x = 187110 tf_correct = logical 1 a = 3.5010e+10 k = 0 sum = 0 c = 0 k = 1 m = 0 sum = 0 c = 1 a = 3.5010e+09 k = 2 m = 0 0 sum = 0 c = 2 a = 350101521 k = 3 m = 0 0 1 sum = 1 c = 3 a = 35010152 k = 4 m = 0 0 1 2 sum = 3 c = 4 a = 3501015 k = 5 m = 0 0 1 2 5 sum = 8 c = 5 a = 350101 k = 6 m = 0 0 1 2 5 1 sum = 9 c = 6 a = 35010 k = 7 m = 0 0 1 2 5 1 0 sum = 9 c = 7 a = 3501 k = 8 m = 0 0 1 2 5 1 0 1 sum = 10 c = 8 a = 350 k = 9 m = 0 0 1 2 5 1 0 1 0 sum = 10 c = 9 a = 35 k = 10 m = 0 0 1 2 5 1 0 1 0 5 sum = 15 c = 10 a = 3 k = 11 m = 0 0 1 2 5 1 0 1 0 5 3 sum = 18 c = 11 a = 0 b = 3 5 0 1 0 1 5 2 1 0 0 n = 1 x1 = 3 5 0 1 0 x2 = 1 5 2 1 0 0 x1 = 3 5 0 1 0 lenx1 = 5 x2 = 1 5 2 1 0 0 lenx2 = 6 sum11 = 0 sum11 = 30000 sum11 = 35000 sum11 = 35000 sum11 = 35010 sum11 = 35010 sum22 = 0 sum22 = 100000 sum22 = 150000 sum22 = 152000 sum22 = 152100 sum22 = 152100 sum22 = 152100 num = 187110 b = logical 1

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

x = 208495 tf_correct = logical 1 a = 4.3470e+10 k = 0 sum = 0 c = 0 k = 1 m = 5 sum = 5 c = 1 a = 4.3470e+09 k = 2 m = 5 2 sum = 7 c = 2 a = 434701650 k = 3 m = 5 2 0 sum = 7 c = 3 a = 43470165 k = 4 m = 5 2 0 5 sum = 12 c = 4 a = 4347016 k = 5 m = 5 2 0 5 6 sum = 18 c = 5 a = 434701 k = 6 m = 5 2 0 5 6 1 sum = 19 c = 6 a = 43470 k = 7 m = 5 2 0 5 6 1 0 sum = 19 c = 7 a = 4347 k = 8 m = 5 2 0 5 6 1 0 7 sum = 26 c = 8 a = 434 k = 9 m = 5 2 0 5 6 1 0 7 4 sum = 30 c = 9 a = 43 k = 10 m = 5 2 0 5 6 1 0 7 4 3 sum = 33 c = 10 a = 4 k = 11 m = 5 2 0 5 6 1 0 7 4 3 4 sum = 37 c = 11 a = 0 b = 4 3 4 7 0 1 6 5 0 2 5 n = 1 x1 = 4 3 4 7 0 x2 = 1 6 5 0 2 5 x1 = 4 3 4 7 0 lenx1 = 5 x2 = 1 6 5 0 2 5 lenx2 = 6 sum11 = 0 sum11 = 40000 sum11 = 43000 sum11 = 43400 sum11 = 43470 sum11 = 43470 sum22 = 0 sum22 = 100000 sum22 = 160000 sum22 = 165000 sum22 = 165000 sum22 = 165020 sum22 = 165025 num = 208495 b = logical 1

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

x = 318682 tf_correct = logical 1 a = 1.0156e+11 k = 0 sum = 0 c = 0 k = 1 m = 4 sum = 4 c = 1 a = 1.0156e+10 k = 2 m = 4 2 sum = 6 c = 2 a = 1.0156e+09 k = 3 m = 4 2 1 sum = 7 c = 3 a = 101558217 k = 4 m = 4 2 1 7 sum = 14 c = 4 a = 10155821 k = 5 m = 4 2 1 7 1 sum = 15 c = 5 a = 1015582 k = 6 m = 4 2 1 7 1 2 sum = 17 c = 6 a = 101558 k = 7 m = 4 2 1 7 1 2 8 sum = 25 c = 7 a = 10155 k = 8 m = 4 2 1 7 1 2 8 5 sum = 30 c = 8 a = 1015 k = 9 m = 4 2 1 7 1 2 8 5 5 sum = 35 c = 9 a = 101 k = 10 m = 4 2 1 7 1 2 8 5 5 1 sum = 36 c = 10 a = 10 k = 11 m = 4 2 1 7 1 2 8 5 5 1 0 sum = 36 c = 11 a = 1 k = 12 m = 4 2 1 7 1 2 8 5 5 1 0 1 sum = 37 c = 12 a = 0 b = 1 0 1 5 5 8 2 1 7 1 2 4 n = 0 x1 = 1 0 1 5 5 8 x2 = 2 1 7 1 2 4 x1 = 1 0 1 5 5 8 lenx1 = 6 x2 = 2 1 7 1 2 4 lenx2 = 6 sum11 = 0 sum11 = 100000 sum11 = 100000 sum11 = 101000 sum11 = 101500 sum11 = 101550 sum11 = 101558 sum22 = 0 sum22 = 200000 sum22 = 210000 sum22 = 217000 sum22 = 217100 sum22 = 217120 sum22 = 217124 num = 318682 b = logical 1

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

x = 329967 tf_correct = logical 1 a = 1.0888e+11 k = 0 sum = 0 c = 0 k = 1 m = 9 sum = 9 c = 1 a = 1.0888e+10 k = 2 m = 9 8 sum = 17 c = 2 a = 1.0888e+09 k = 3 m = 9 8 0 sum = 17 c = 3 a = 108878221 k = 4 m = 9 8 0 1 sum = 18 c = 4 a = 10887822 k = 5 m = 9 8 0 1 2 sum = 20 c = 5 a = 1088782 k = 6 m = 9 8 0 1 2 2 sum = 22 c = 6 a = 108878 k = 7 m = 9 8 0 1 2 2 8 sum = 30 c = 7 a = 10887 k = 8 m = 9 8 0 1 2 2 8 7 sum = 37 c = 8 a = 1088 k = 9 m = 9 8 0 1 2 2 8 7 8 sum = 45 c = 9 a = 108 k = 10 m = 9 8 0 1 2 2 8 7 8 8 sum = 53 c = 10 a = 10 k = 11 m = 9 8 0 1 2 2 8 7 8 8 0 sum = 53 c = 11 a = 1 k = 12 m = 9 8 0 1 2 2 8 7 8 8 0 1 sum = 54 c = 12 a = 0 b = 1 0 8 8 7 8 2 2 1 0 8 9 n = 0 x1 = 1 0 8 8 7 8 x2 = 2 2 1 0 8 9 x1 = 1 0 8 8 7 8 lenx1 = 6 x2 = 2 2 1 0 8 9 lenx2 = 6 sum11 = 0 sum11 = 100000 sum11 = 100000 sum11 = 108000 sum11 = 108800 sum11 = 108870 sum11 = 108878 sum22 = 0 sum22 = 200000 sum22 = 220000 sum22 = 221000 sum22 = 221000 sum22 = 221080 sum22 = 221089 num = 329967 b = logical 1

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

x = 351352 tf_correct = logical 1 a = 1.2345e+11 k = 0 sum = 0 c = 0 k = 1 m = 4 sum = 4 c = 1 a = 1.2345e+10 k = 2 m = 4 0 sum = 4 c = 2 a = 1.2345e+09 k = 3 m = 4 0 9 sum = 13 c = 3 a = 123448227 k = 4 m = 4 0 9 7 sum = 20 c = 4 a = 12344822 k = 5 m = 4 0 9 7 2 sum = 22 c = 5 a = 1234482 k = 6 m = 4 0 9 7 2 2 sum = 24 c = 6 a = 123448 k = 7 m = 4 0 9 7 2 2 8 sum = 32 c = 7 a = 12344 k = 8 m = 4 0 9 7 2 2 8 4 sum = 36 c = 8 a = 1234 k = 9 m = 4 0 9 7 2 2 8 4 4 sum = 40 c = 9 a = 123 k = 10 m = 4 0 9 7 2 2 8 4 4 3 sum = 43 c = 10 a = 12 k = 11 m = 4 0 9 7 2 2 8 4 4 3 2 sum = 45 c = 11 a = 1 k = 12 m = 4 0 9 7 2 2 8 4 4 3 2 1 sum = 46 c = 12 a = 0 b = 1 2 3 4 4 8 2 2 7 9 0 4 n = 0 x1 = 1 2 3 4 4 8 x2 = 2 2 7 9 0 4 x1 = 1 2 3 4 4 8 lenx1 = 6 x2 = 2 2 7 9 0 4 lenx2 = 6 sum11 = 0 sum11 = 100000 sum11 = 120000 sum11 = 123000 sum11 = 123400 sum11 = 123440 sum11 = 123448 sum22 = 0 sum22 = 200000 sum22 = 220000 sum22 = 227000 sum22 = 227900 sum22 = 227900 sum22 = 227904 num = 351352 b = logical 1

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

x = 356643 tf_correct = logical 1 a = 1.2719e+11 k = 0 sum = 0 c = 0 k = 1 m = 9 sum = 9 c = 1 a = 1.2719e+10 k = 2 m = 9 4 sum = 13 c = 2 a = 1.2719e+09 k = 3 m = 9 4 4 sum = 17 c = 3 a = 127194229 k = 4 m = 9 4 4 9 sum = 26 c = 4 a = 12719422 k = 5 m = 9 4 4 9 2 sum = 28 c = 5 a = 1271942 k = 6 m = 9 4 4 9 2 2 sum = 30 c = 6 a = 127194 k = 7 m = 9 4 4 9 2 2 4 sum = 34 c = 7 a = 12719 k = 8 m = 9 4 4 9 2 2 4 9 sum = 43 c = 8 a = 1271 k = 9 m = 9 4 4 9 2 2 4 9 1 sum = 44 c = 9 a = 127 k = 10 m = 9 4 4 9 2 2 4 9 1 7 sum = 51 c = 10 a = 12 k = 11 m = 9 4 4 9 2 2 4 9 1 7 2 sum = 53 c = 11 a = 1 k = 12 m = 9 4 4 9 2 2 4 9 1 7 2 1 sum = 54 c = 12 a = 0 b = 1 2 7 1 9 4 2 2 9 4 4 9 n = 0 x1 = 1 2 7 1 9 4 x2 = 2 2 9 4 4 9 x1 = 1 2 7 1 9 4 lenx1 = 6 x2 = 2 2 9 4 4 9 lenx2 = 6 sum11 = 0 sum11 = 100000 sum11 = 120000 sum11 = 127000 sum11 = 127100 sum11 = 127190 sum11 = 127194 sum22 = 0 sum22 = 200000 sum22 = 220000 sum22 = 229000 sum22 = 229400 sum22 = 229440 sum22 = 229449 num = 356643 b = logical 1

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

x = 390313 tf_correct = logical 1 a = 1.5234e+11 k = 0 sum = 0 c = 0 k = 1 m = 9 sum = 9 c = 1 a = 1.5234e+10 k = 2 m = 9 6 sum = 15 c = 2 a = 1.5234e+09 k = 3 m = 9 6 9 sum = 24 c = 3 a = 152344237 k = 4 m = 9 6 9 7 sum = 31 c = 4 a = 15234423 k = 5 m = 9 6 9 7 3 sum = 34 c = 5 a = 1523442 k = 6 m = 9 6 9 7 3 2 sum = 36 c = 6 a = 152344 k = 7 m = 9 6 9 7 3 2 4 sum = 40 c = 7 a = 15234 k = 8 m = 9 6 9 7 3 2 4 4 sum = 44 c = 8 a = 1523 k = 9 m = 9 6 9 7 3 2 4 4 3 sum = 47 c = 9 a = 152 k = 10 m = 9 6 9 7 3 2 4 4 3 2 sum = 49 c = 10 a = 15 k = 11 m = 9 6 9 7 3 2 4 4 3 2 5 sum = 54 c = 11 a = 1 k = 12 m = 9 6 9 7 3 2 4 4 3 2 5 1 sum = 55 c = 12 a = 0 b = 1 5 2 3 4 4 2 3 7 9 6 9 n = 0 x1 = 1 5 2 3 4 4 x2 = 2 3 7 9 6 9 x1 = 1 5 2 3 4 4 lenx1 = 6 x2 = 2 3 7 9 6 9 lenx2 = 6 sum11 = 0 sum11 = 100000 sum11 = 150000 sum11 = 152000 sum11 = 152300 sum11 = 152340 sum11 = 152344 sum22 = 0 sum22 = 200000 sum22 = 230000 sum22 = 237000 sum22 = 237900 sum22 = 237960 sum22 = 237969 num = 390313 b = logical 1

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

x = 461539 tf_correct = logical 1 a = 2.1302e+11 k = 0 sum = 0 c = 0 k = 1 m = 1 sum = 1 c = 1 a = 2.1302e+10 k = 2 m = 1 2 sum = 3 c = 2 a = 2.1302e+09 k = 3 m = 1 2 5 sum = 8 c = 3 a = 213018248 k = 4 m = 1 2 5 8 sum = 16 c = 4 a = 21301824 k = 5 m = 1 2 5 8 4 sum = 20 c = 5 a = 2130182 k = 6 m = 1 2 5 8 4 2 sum = 22 c = 6 a = 213018 k = 7 m = 1 2 5 8 4 2 8 sum = 30 c = 7 a = 21301 k = 8 m = 1 2 5 8 4 2 8 1 sum = 31 c = 8 a = 2130 k = 9 m = 1 2 5 8 4 2 8 1 0 sum = 31 c = 9 a = 213 k = 10 m = 1 2 5 8 4 2 8 1 0 3 sum = 34 c = 10 a = 21 k = 11 m = 1 2 5 8 4 2 8 1 0 3 1 sum = 35 c = 11 a = 2 k = 12 m = 1 2 5 8 4 2 8 1 0 3 1 2 sum = 37 c = 12 a = 0 b = 2 1 3 0 1 8 2 4 8 5 2 1 n = 0 x1 = 2 1 3 0 1 8 x2 = 2 4 8 5 2 1 x1 = 2 1 3 0 1 8 lenx1 = 6 x2 = 2 4 8 5 2 1 lenx2 = 6 sum11 = 0 sum11 = 200000 sum11 = 210000 sum11 = 213000 sum11 = 213000 sum11 = 213010 sum11 = 213018 sum22 = 0 sum22 = 200000 sum22 = 240000 sum22 = 248000 sum22 = 248500 sum22 = 248520 sum22 = 248521 num = 461539 b = logical 1

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

x = 466830 tf_correct = logical 1 a = 2.1793e+11 k = 0 sum = 0 c = 0 k = 1 m = 0 sum = 0 c = 1 a = 2.1793e+10 k = 2 m = 0 0 sum = 0 c = 2 a = 2.1793e+09 k = 3 m = 0 0 9 sum = 9 c = 3 a = 217930248 k = 4 m = 0 0 9 8 sum = 17 c = 4 a = 21793024 k = 5 m = 0 0 9 8 4 sum = 21 c = 5 a = 2179302 k = 6 m = 0 0 9 8 4 2 sum = 23 c = 6 a = 217930 k = 7 m = 0 0 9 8 4 2 0 sum = 23 c = 7 a = 21793 k = 8 m = 0 0 9 8 4 2 0 3 sum = 26 c = 8 a = 2179 k = 9 m = 0 0 9 8 4 2 0 3 9 sum = 35 c = 9 a = 217 k = 10 m = 0 0 9 8 4 2 0 3 9 7 sum = 42 c = 10 a = 21 k = 11 m = 0 0 9 8 4 2 0 3 9 7 1 sum = 43 c = 11 a = 2 k = 12 m = 0 0 9 8 4 2 0 3 9 7 1 2 sum = 45 c = 12 a = 0 b = 2 1 7 9 3 0 2 4 8 9 0 0 n = 0 x1 = 2 1 7 9 3 0 x2 = 2 4 8 9 0 0 x1 = 2 1 7 9 3 0 lenx1 = 6 x2 = 2 4 8 9 0 0 lenx2 = 6 sum11 = 0 sum11 = 200000 sum11 = 210000 sum11 = 217000 sum11 = 217900 sum11 = 217930 sum11 = 217930 sum22 = 0 sum22 = 200000 sum22 = 240000 sum22 = 248000 sum22 = 248900 sum22 = 248900 sum22 = 248900 num = 466830 b = logical 1

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

x = 499500 tf_correct = logical 1 a = 2.4950e+11 k = 0 sum = 0 c = 0 k = 1 m = 0 sum = 0 c = 1 a = 2.4950e+10 k = 2 m = 0 0 sum = 0 c = 2 a = 2.4950e+09 k = 3 m = 0 0 0 sum = 0 c = 3 a = 249500250 k = 4 m = 0 0 0 0 sum = 0 c = 4 a = 24950025 k = 5 m = 0 0 0 0 5 sum = 5 c = 5 a = 2495002 k = 6 m = 0 0 0 0 5 2 sum = 7 c = 6 a = 249500 k = 7 m = 0 0 0 0 5 2 0 sum = 7 c = 7 a = 24950 k = 8 m = 0 0 0 0 5 2 0 0 sum = 7 c = 8 a = 2495 k = 9 m = 0 0 0 0 5 2 0 0 5 sum = 12 c = 9 a = 249 k = 10 m = 0 0 0 0 5 2 0 0 5 9 sum = 21 c = 10 a = 24 k = 11 m = 0 0 0 0 5 2 0 0 5 9 4 sum = 25 c = 11 a = 2 k = 12 m = 0 0 0 0 5 2 0 0 5 9 4 2 sum = 27 c = 12 a = 0 b = 2 4 9 5 0 0 2 5 0 0 0 0 n = 0 x1 = 2 4 9 5 0 0 x2 = 2 5 0 0 0 0 x1 = 2 4 9 5 0 0 lenx1 = 6 x2 = 2 5 0 0 0 0 lenx2 = 6 sum11 = 0 sum11 = 200000 sum11 = 240000 sum11 = 249000 sum11 = 249500 sum11 = 249500 sum11 = 249500 sum22 = 0 sum22 = 200000 sum22 = 250000 sum22 = 250000 sum22 = 250000 sum22 = 250000 sum22 = 250000 num = 499500 b = logical 1

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

x = 500500 tf_correct = logical 1 a = 2.5050e+11 k = 0 sum = 0 c = 0 k = 1 m = 0 sum = 0 c = 1 a = 2.5050e+10 k = 2 m = 0 0 sum = 0 c = 2 a = 2.5050e+09 k = 3 m = 0 0 0 sum = 0 c = 3 a = 250500250 k = 4 m = 0 0 0 0 sum = 0 c = 4 a = 25050025 k = 5 m = 0 0 0 0 5 sum = 5 c = 5 a = 2505002 k = 6 m = 0 0 0 0 5 2 sum = 7 c = 6 a = 250500 k = 7 m = 0 0 0 0 5 2 0 sum = 7 c = 7 a = 25050 k = 8 m = 0 0 0 0 5 2 0 0 sum = 7 c = 8 a = 2505 k = 9 m = 0 0 0 0 5 2 0 0 5 sum = 12 c = 9 a = 250 k = 10 m = 0 0 0 0 5 2 0 0 5 0 sum = 12 c = 10 a = 25 k = 11 m = 0 0 0 0 5 2 0 0 5 0 5 sum = 17 c = 11 a = 2 k = 12 m = 0 0 0 0 5 2 0 0 5 0 5 2 sum = 19 c = 12 a = 0 b = 2 5 0 5 0 0 2 5 0 0 0 0 n = 0 x1 = 2 5 0 5 0 0 x2 = 2 5 0 0 0 0 x1 = 2 5 0 5 0 0 lenx1 = 6 x2 = 2 5 0 0 0 0 lenx2 = 6 sum11 = 0 sum11 = 200000 sum11 = 250000 sum11 = 250000 sum11 = 250500 sum11 = 250500 sum11 = 250500 sum22 = 0 sum22 = 200000 sum22 = 250000 sum22 = 250000 sum22 = 250000 sum22 = 250000 sum22 = 250000 num = 500500 b = logical 1

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

x = 533170 tf_correct = logical 1 a = 2.8427e+11 k = 0 sum = 0 c = 0 k = 1 m = 0 sum = 0 c = 1 a = 2.8427e+10 k = 2 m = 0 0 sum = 0 c = 2 a = 2.8427e+09 k = 3 m = 0 0 9 sum = 9 c = 3 a = 284270248 k = 4 m = 0 0 9 8 sum = 17 c = 4 a = 28427024 k = 5 m = 0 0 9 8 4 sum = 21 c = 5 a = 2842702 k = 6 m = 0 0 9 8 4 2 sum = 23 c = 6 a = 284270 k = 7 m = 0 0 9 8 4 2 0 sum = 23 c = 7 a = 28427 k = 8 m = 0 0 9 8 4 2 0 7 sum = 30 c = 8 a = 2842 k = 9 m = 0 0 9 8 4 2 0 7 2 sum = 32 c = 9 a = 284 k = 10 m = 0 0 9 8 4 2 0 7 2 4 sum = 36 c = 10 a = 28 k = 11 m = 0 0 9 8 4 2 0 7 2 4 8 sum = 44 c = 11 a = 2 k = 12 m = 0 0 9 8 4 2 0 7 2 4 8 2 sum = 46 c = 12 a = 0 b = 2 8 4 2 7 0 2 4 8 9 0 0 n = 0 x1 = 2 8 4 2 7 0 x2 = 2 4 8 9 0 0 x1 = 2 8 4 2 7 0 lenx1 = 6 x2 = 2 4 8 9 0 0 lenx2 = 6 sum11 = 0 sum11 = 200000 sum11 = 280000 sum11 = 284000 sum11 = 284200 sum11 = 284270 sum11 = 284270 sum22 = 0 sum22 = 200000 sum22 = 240000 sum22 = 248000 sum22 = 248900 sum22 = 248900 sum22 = 248900 num = 533170 b = logical 1

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

x = 538461 tf_correct = logical 1 a = 2.8994e+11 k = 0 sum = 0 c = 0 k = 1 m = 1 sum = 1 c = 1 a = 2.8994e+10 k = 2 m = 1 2 sum = 3 c = 2 a = 2.8994e+09 k = 3 m = 1 2 5 sum = 8 c = 3 a = 289940248 k = 4 m = 1 2 5 8 sum = 16 c = 4 a = 28994024 k = 5 m = 1 2 5 8 4 sum = 20 c = 5 a = 2899402 k = 6 m = 1 2 5 8 4 2 sum = 22 c = 6 a = 289940 k = 7 m = 1 2 5 8 4 2 0 sum = 22 c = 7 a = 28994 k = 8 m = 1 2 5 8 4 2 0 4 sum = 26 c = 8 a = 2899 k = 9 m = 1 2 5 8 4 2 0 4 9 sum = 35 c = 9 a = 289 k = 10 m = 1 2 5 8 4 2 0 4 9 9 sum = 44 c = 10 a = 28 k = 11 m = 1 2 5 8 4 2 0 4 9 9 8 sum = 52 c = 11 a = 2 k = 12 m = 1 2 5 8 4 2 0 4 9 9 8 2 sum = 54 c = 12 a = 0 b = 2 8 9 9 4 0 2 4 8 5 2 1 n = 0 x1 = 2 8 9 9 4 0 x2 = 2 4 8 5 2 1 x1 = 2 8 9 9 4 0 lenx1 = 6 x2 = 2 4 8 5 2 1 lenx2 = 6 sum11 = 0 sum11 = 200000 sum11 = 280000 sum11 = 289000 sum11 = 289900 sum11 = 289940 sum11 = 289940 sum22 = 0 sum22 = 200000 sum22 = 240000 sum22 = 248000 sum22 = 248500 sum22 = 248520 sum22 = 248521 num = 538461 b = logical 1

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

x = 609687 tf_correct = logical 1 a = 3.7172e+11 k = 0 sum = 0 c = 0 k = 1 m = 9 sum = 9 c = 1 a = 3.7172e+10 k = 2 m = 9 6 sum = 15 c = 2 a = 3.7172e+09 k = 3 m = 9 6 9 sum = 24 c = 3 a = 371718237 k = 4 m = 9 6 9 7 sum = 31 c = 4 a = 37171823 k = 5 m = 9 6 9 7 3 sum = 34 c = 5 a = 3717182 k = 6 m = 9 6 9 7 3 2 sum = 36 c = 6 a = 371718 k = 7 m = 9 6 9 7 3 2 8 sum = 44 c = 7 a = 37171 k = 8 m = 9 6 9 7 3 2 8 1 sum = 45 c = 8 a = 3717 k = 9 m = 9 6 9 7 3 2 8 1 7 sum = 52 c = 9 a = 371 k = 10 m = 9 6 9 7 3 2 8 1 7 1 sum = 53 c = 10 a = 37 k = 11 m = 9 6 9 7 3 2 8 1 7 1 7 sum = 60 c = 11 a = 3 k = 12 m = 9 6 9 7 3 2 8 1 7 1 7 3 sum = 63 c = 12 a = 0 b = 3 7 1 7 1 8 2 3 7 9 6 9 n = 0 x1 = 3 7 1 7 1 8 x2 = 2 3 7 9 6 9 x1 = 3 7 1 7 1 8 lenx1 = 6 x2 = 2 3 7 9 6 9 lenx2 = 6 sum11 = 0 sum11 = 300000 sum11 = 370000 sum11 = 371000 sum11 = 371700 sum11 = 371710 sum11 = 371718 sum22 = 0 sum22 = 200000 sum22 = 230000 sum22 = 237000 sum22 = 237900 sum22 = 237960 sum22 = 237969 num = 609687 b = logical 1

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

x = 643357 tf_correct = logical 1 a = 4.1391e+11 k = 0 sum = 0 c = 0 k = 1 m = 9 sum = 9 c = 1 a = 4.1391e+10 k = 2 m = 9 4 sum = 13 c = 2 a = 4.1391e+09 k = 3 m = 9 4 4 sum = 17 c = 3 a = 413908229 k = 4 m = 9 4 4 9 sum = 26 c = 4 a = 41390822 k = 5 m = 9 4 4 9 2 sum = 28 c = 5 a = 4139082 k = 6 m = 9 4 4 9 2 2 sum = 30 c = 6 a = 413908 k = 7 m = 9 4 4 9 2 2 8 sum = 38 c = 7 a = 41390 k = 8 m = 9 4 4 9 2 2 8 0 sum = 38 c = 8 a = 4139 k = 9 m = 9 4 4 9 2 2 8 0 9 sum = 47 c = 9 a = 413 k = 10 m = 9 4 4 9 2 2 8 0 9 3 sum = 50 c = 10 a = 41 k = 11 m = 9 4 4 9 2 2 8 0 9 3 1 sum = 51 c = 11 a = 4 k = 12 m = 9 4 4 9 2 2 8 0 9 3 1 4 sum = 55 c = 12 a = 0 b = 4 1 3 9 0 8 2 2 9 4 4 9 n = 0 x1 = 4 1 3 9 0 8 x2 = 2 2 9 4 4 9 x1 = 4 1 3 9 0 8 lenx1 = 6 x2 = 2 2 9 4 4 9 lenx2 = 6 sum11 = 0 sum11 = 400000 sum11 = 410000 sum11 = 413000 sum11 = 413900 sum11 = 413900 sum11 = 413908 sum22 = 0 sum22 = 200000 sum22 = 220000 sum22 = 229000 sum22 = 229400 sum22 = 229440 sum22 = 229449 num = 643357 b = logical 1

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

x = 648648 tf_correct = logical 1 a = 4.2074e+11 k = 0 sum = 0 c = 0 k = 1 m = 4 sum = 4 c = 1 a = 4.2074e+10 k = 2 m = 4 0 sum = 4 c = 2 a = 4.2074e+09 k = 3 m = 4 0 9 sum = 13 c = 3 a = 420744227 k = 4 m = 4 0 9 7 sum = 20 c = 4 a = 42074422 k = 5 m = 4 0 9 7 2 sum = 22 c = 5 a = 4207442 k = 6 m = 4 0 9 7 2 2 sum = 24 c = 6 a = 420744 k = 7 m = 4 0 9 7 2 2 4 sum = 28 c = 7 a = 42074 k = 8 m = 4 0 9 7 2 2 4 4 sum = 32 c = 8 a = 4207 k = 9 m = 4 0 9 7 2 2 4 4 7 sum = 39 c = 9 a = 420 k = 10 m = 4 0 9 7 2 2 4 4 7 0 sum = 39 c = 10 a = 42 k = 11 m = 4 0 9 7 2 2 4 4 7 0 2 sum = 41 c = 11 a = 4 k = 12 m = 4 0 9 7 2 2 4 4 7 0 2 4 sum = 45 c = 12 a = 0 b = 4 2 0 7 4 4 2 2 7 9 0 4 n = 0 x1 = 4 2 0 7 4 4 x2 = 2 2 7 9 0 4 x1 = 4 2 0 7 4 4 lenx1 = 6 x2 = 2 2 7 9 0 4 lenx2 = 6 sum11 = 0 sum11 = 400000 sum11 = 420000 sum11 = 420000 sum11 = 420700 sum11 = 420740 sum11 = 420744 sum22 = 0 sum22 = 200000 sum22 = 220000 sum22 = 227000 sum22 = 227900 sum22 = 227900 sum22 = 227904 num = 648648 b = logical 1

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

x = 670033 tf_correct = logical 1 a = 4.4894e+11 k = 0 sum = 0 c = 0 k = 1 m = 9 sum = 9 c = 1 a = 4.4894e+10 k = 2 m = 9 8 sum = 17 c = 2 a = 4.4894e+09 k = 3 m = 9 8 0 sum = 17 c = 3 a = 448944221 k = 4 m = 9 8 0 1 sum = 18 c = 4 a = 44894422 k = 5 m = 9 8 0 1 2 sum = 20 c = 5 a = 4489442 k = 6 m = 9 8 0 1 2 2 sum = 22 c = 6 a = 448944 k = 7 m = 9 8 0 1 2 2 4 sum = 26 c = 7 a = 44894 k = 8 m = 9 8 0 1 2 2 4 4 sum = 30 c = 8 a = 4489 k = 9 m = 9 8 0 1 2 2 4 4 9 sum = 39 c = 9 a = 448 k = 10 m = 9 8 0 1 2 2 4 4 9 8 sum = 47 c = 10 a = 44 k = 11 m = 9 8 0 1 2 2 4 4 9 8 4 sum = 51 c = 11 a = 4 k = 12 m = 9 8 0 1 2 2 4 4 9 8 4 4 sum = 55 c = 12 a = 0 b = 4 4 8 9 4 4 2 2 1 0 8 9 n = 0 x1 = 4 4 8 9 4 4 x2 = 2 2 1 0 8 9 x1 = 4 4 8 9 4 4 lenx1 = 6 x2 = 2 2 1 0 8 9 lenx2 = 6 sum11 = 0 sum11 = 400000 sum11 = 440000 sum11 = 448000 sum11 = 448900 sum11 = 448940 sum11 = 448944 sum22 = 0 sum22 = 200000 sum22 = 220000 sum22 = 221000 sum22 = 221000 sum22 = 221080 sum22 = 221089 num = 670033 b = logical 1

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

x = 681318 tf_correct = logical 1 a = 4.6419e+11 k = 0 sum = 0 c = 0 k = 1 m = 4 sum = 4 c = 1 a = 4.6419e+10 k = 2 m = 4 2 sum = 6 c = 2 a = 4.6419e+09 k = 3 m = 4 2 1 sum = 7 c = 3 a = 464194217 k = 4 m = 4 2 1 7 sum = 14 c = 4 a = 46419421 k = 5 m = 4 2 1 7 1 sum = 15 c = 5 a = 4641942 k = 6 m = 4 2 1 7 1 2 sum = 17 c = 6 a = 464194 k = 7 m = 4 2 1 7 1 2 4 sum = 21 c = 7 a = 46419 k = 8 m = 4 2 1 7 1 2 4 9 sum = 30 c = 8 a = 4641 k = 9 m = 4 2 1 7 1 2 4 9 1 sum = 31 c = 9 a = 464 k = 10 m = 4 2 1 7 1 2 4 9 1 4 sum = 35 c = 10 a = 46 k = 11 m = 4 2 1 7 1 2 4 9 1 4 6 sum = 41 c = 11 a = 4 k = 12 m = 4 2 1 7 1 2 4 9 1 4 6 4 sum = 45 c = 12 a = 0 b = 4 6 4 1 9 4 2 1 7 1 2 4 n = 0 x1 = 4 6 4 1 9 4 x2 = 2 1 7 1 2 4 x1 = 4 6 4 1 9 4 lenx1 = 6 x2 = 2 1 7 1 2 4 lenx2 = 6 sum11 = 0 sum11 = 400000 sum11 = 460000 sum11 = 464000 sum11 = 464100 sum11 = 464190 sum11 = 464194 sum22 = 0 sum22 = 200000 sum22 = 210000 sum22 = 217000 sum22 = 217100 sum22 = 217120 sum22 = 217124 num = 681318 b = logical 1

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

x = 681319 tf_correct = logical 0 a = 4.6420e+11 k = 0 sum = 0 c = 0 k = 1 m = 1 sum = 1 c = 1 a = 4.6420e+10 k = 2 m = 1 6 sum = 7 c = 2 a = 4.6420e+09 k = 3 m = 1 6 7 sum = 14 c = 3 a = 464195579 k = 4 m = 1 6 7 9 sum = 23 c = 4 a = 46419557 k = 5 m = 1 6 7 9 7 sum = 30 c = 5 a = 4641955 k = 6 m = 1 6 7 9 7 5 sum = 35 c = 6 a = 464195 k = 7 m = 1 6 7 9 7 5 5 sum = 40 c = 7 a = 46419 k = 8 m = 1 6 7 9 7 5 5 9 sum = 49 c = 8 a = 4641 k = 9 m = 1 6 7 9 7 5 5 9 1 sum = 50 c = 9 a = 464 k = 10 m = 1 6 7 9 7 5 5 9 1 4 sum = 54 c = 10 a = 46 k = 11 m = 1 6 7 9 7 5 5 9 1 4 6 sum = 60 c = 11 a = 4 k = 12 m = 1 6 7 9 7 5 5 9 1 4 6 4 sum = 64 c = 12 a = 0 b = 4 6 4 1 9 5 5 7 9 7 6 1 n = 0 x1 = 4 6 4 1 9 5 x2 = 5 7 9 7 6 1 x1 = 4 6 4 1 9 5 lenx1 = 6 x2 = 5 7 9 7 6 1 lenx2 = 6 sum11 = 0 sum11 = 400000 sum11 = 460000 sum11 = 464000 sum11 = 464100 sum11 = 464190 sum11 = 464195 sum22 = 0 sum22 = 500000 sum22 = 570000 sum22 = 579000 sum22 = 579700 sum22 = 579760 sum22 = 579761 num = 1043956 b = logical 0

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

x = 681320 tf_correct = logical 0 a = 4.6420e+11 k = 0 sum = 0 c = 0 k = 1 m = 0 sum = 0 c = 1 a = 4.6420e+10 k = 2 m = 0 0 sum = 0 c = 2 a = 4.6420e+09 k = 3 m = 0 0 4 sum = 4 c = 3 a = 464196942 k = 4 m = 0 0 4 2 sum = 6 c = 4 a = 46419694 k = 5 m = 0 0 4 2 4 sum = 10 c = 5 a = 4641969 k = 6 m = 0 0 4 2 4 9 sum = 19 c = 6 a = 464196 k = 7 m = 0 0 4 2 4 9 6 sum = 25 c = 7 a = 46419 k = 8 m = 0 0 4 2 4 9 6 9 sum = 34 c = 8 a = 4641 k = 9 m = 0 0 4 2 4 9 6 9 1 sum = 35 c = 9 a = 464 k = 10 m = 0 0 4 2 4 9 6 9 1 4 sum = 39 c = 10 a = 46 k = 11 m = 0 0 4 2 4 9 6 9 1 4 6 sum = 45 c = 11 a = 4 k = 12 m = 0 0 4 2 4 9 6 9 1 4 6 4 sum = 49 c = 12 a = 0 b = 4 6 4 1 9 6 9 4 2 4 0 0 n = 0 x1 = 4 6 4 1 9 6 x2 = 9 4 2 4 0 0 x1 = 4 6 4 1 9 6 lenx1 = 6 x2 = 9 4 2 4 0 0 lenx2 = 6 sum11 = 0 sum11 = 400000 sum11 = 460000 sum11 = 464000 sum11 = 464100 sum11 = 464190 sum11 = 464196 sum22 = 0 sum22 = 900000 sum22 = 940000 sum22 = 942000 sum22 = 942400 sum22 = 942400 sum22 = 942400 num = 1406596 b = logical 0

### Community Treasure Hunt

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

Start Hunting!