Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 260236

Submitted on 12 Jun 2013 by andrea84

Correct

73Size
Leading solution size is 31.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 

                      

                    
2
Pass
 
%%
x = 704;
tf_correct = false;
assert(isequal(kap(x),tf_correct))
a =
     4
b =
       95616
a =
     4    49
b =
       95616        5616
a =
     4    49   495
b =
       95616        5616         616
a =
           4          49         495        4956
b =
       95616        5616         616          16
a =
           4          49         495        4956       49561
b =
       95616        5616         616          16           6
ans =
     0
3
Pass
 
%%
x = 9
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
     9
tf_correct =
     1
a =
     8
b =
     1
ans =
     1
4
Pass
 
%%
x = 45
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
    45
tf_correct =
     1
a =
     2
b =
    25
a =
     2    20
b =
    25    25
a =
     2    20   202
b =
    25    25     5
ans =
     1
5
Pass
 
%%
x = 55
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
    55
tf_correct =
     1
a =
     3
b =
    25
a =
     3    30
b =
    25    25
a =
     3    30   302
b =
    25    25     5
ans =
     1
6
Pass
 
%%
x = 99
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
    99
tf_correct =
     1
a =
     9
b =
   801
a =
     9    98
b =
   801     1
a =
     9    98   980
b =
   801     1     1
ans =
     1
7
Pass
 
%%
x = 297
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
   297
tf_correct =
     1
a =
     8
b =
        8209
a =
     8    88
b =
        8209         209
a =
     8    88   882
b =
        8209         209           9
a =
           8          88         882        8820
b =
        8209         209           9           9
ans =
     1
8
Pass
 
%%
x = 703
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
   703
tf_correct =
     1
a =
     4
b =
       94209
a =
     4    49
b =
       94209        4209
a =
     4    49   494
b =
       94209        4209         209
a =
           4          49         494        4942
b =
       94209        4209         209           9
a =
           4          49         494        4942       49420
b =
       94209        4209         209           9           9
ans =
     1
9
Pass
 
%%
x = 999
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
   999
tf_correct =
     1
a =
     9
b =
       98001
a =
     9    99
b =
       98001        8001
a =
     9    99   998
b =
       98001        8001           1
a =
           9          99         998        9980
b =
       98001        8001           1           1
a =
           9          99         998        9980       99800
b =
       98001        8001           1           1           1
ans =
     1
10
Pass
 
%%
x = 2223
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
        2223
tf_correct =
     1
a =
     4
b =
      941729
a =
     4    49
b =
      941729       41729
a =
     4    49   494
b =
      941729       41729        1729
a =
           4          49         494        4941
b =
      941729       41729        1729         729
a =
           4          49         494        4941       49417
b =
      941729       41729        1729         729          29
a =
           4          49         494        4941       49417      494172
b =
      941729       41729        1729         729          29           9
ans =
     1
11
Pass
 
%%
x = 2728
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
        2728
tf_correct =
     1
a =
     7
b =
      441984
a =
     7    74
b =
      441984       41984
a =
     7    74   744
b =
      441984       41984        1984
a =
           7          74         744        7441
b =
      441984       41984        1984         984
a =
           7          74         744        7441       74419
b =
      441984       41984        1984         984          84
a =
           7          74         744        7441       74419      744198
b =
      441984       41984        1984         984          84           4
ans =
     1
12
Pass
 
%%
x = 4950
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
        4950
tf_correct =
     1
a =
     2
b =
     4502500
a =
     2    24
b =
     4502500      502500
a =
     2    24   245
b =
     4502500      502500        2500
a =
           2          24         245        2450
b =
     4502500      502500        2500        2500
a =
           2          24         245        2450       24502
b =
     4502500      502500        2500        2500         500
a =
           2          24         245        2450       24502      245025
b =
     4502500      502500        2500        2500         500           0
a =
           2          24         245        2450       24502      245025     2450250
b =
     4502500      502500        2500        2500         500           0           0
ans =
     1
13
Pass
 
%%
x = 5050
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
        5050
tf_correct =
     1
a =
     2
b =
     5502500
a =
     2    25
b =
     5502500      502500
a =
     2    25   255
b =
     5502500      502500        2500
a =
           2          25         255        2550
b =
     5502500      502500        2500        2500
a =
           2          25         255        2550       25502
b =
     5502500      502500        2500        2500         500
a =
           2          25         255        2550       25502      255025
b =
     5502500      502500        2500        2500         500           0
a =
           2          25         255        2550       25502      255025     2550250
b =
     5502500      502500        2500        2500         500           0           0
ans =
     1
14
Pass
 
%%
x = 7272
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
        7272
tf_correct =
     1
a =
     5
b =
     2881984
a =
     5    52
b =
     2881984      881984
a =
     5    52   528
b =
     2881984      881984       81984
a =
           5          52         528        5288
b =
     2881984      881984       81984        1984
a =
           5          52         528        5288       52881
b =
     2881984      881984       81984        1984         984
a =
           5          52         528        5288       52881      528819
b =
     2881984      881984       81984        1984         984          84
a =
           5          52         528        5288       52881      528819     5288198
b =
     2881984      881984       81984        1984         984          84           4
ans =
     1
15
Pass
 
%%
x = 7777
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
        7777
tf_correct =
     1
a =
     6
b =
      481729
a =
     6    60
b =
      481729      481729
a =
     6    60   604
b =
      481729      481729       81729
a =
           6          60         604        6048
b =
      481729      481729       81729        1729
a =
           6          60         604        6048       60481
b =
      481729      481729       81729        1729         729
a =
           6          60         604        6048       60481      604817
b =
      481729      481729       81729        1729         729          29
a =
           6          60         604        6048       60481      604817     6048172
b =
      481729      481729       81729        1729         729          29           9
ans =
     1
16
Pass
 
%%
x = 9999
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
        9999
tf_correct =
     1
a =
     9
b =
     9980001
a =
     9    99
b =
     9980001      980001
a =
     9    99   999
b =
     9980001      980001       80001
a =
           9          99         999        9998
b =
     9980001      980001       80001           1
a =
           9          99         999        9998       99980
b =
     9980001      980001       80001           1           1
a =
           9          99         999        9998       99980      999800
b =
     9980001      980001       80001           1           1           1
a =
           9          99         999        9998       99980      999800     9998000
b =
     9980001      980001       80001           1           1           1           1
ans =
     1
17
Pass
 
%%
x = 17344
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
       17344
tf_correct =
     1
a =
     3
b =
      814336
a =
     3    30
b =
      814336      814336
a =
     3    30   300
b =
      814336      814336      814336
a =
           3          30         300        3008
b =
      814336      814336      814336       14336
a =
           3          30         300        3008       30081
b =
      814336      814336      814336       14336        4336
a =
           3          30         300        3008       30081      300814
b =
      814336      814336      814336       14336        4336         336
a =
           3          30         300        3008       30081      300814     3008143
b =
      814336      814336      814336       14336        4336         336          36
a =
           3          30         300        3008       30081      300814     3008143    30081433
b =
      814336      814336      814336       14336        4336         336          36           6
ans =
     1
18
Pass
 
%%
x = 22222
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
       22222
tf_correct =
     1
a =
     4
b =
    93817284
a =
     4    49
b =
    93817284     3817284
a =
     4    49   493
b =
    93817284     3817284      817284
a =
           4          49         493        4938
b =
    93817284     3817284      817284       17284
a =
           4          49         493        4938       49381
b =
    93817284     3817284      817284       17284        7284
a =
           4          49         493        4938       49381      493817
b =
    93817284     3817284      817284       17284        7284         284
a =
           4          49         493        4938       49381      493817     4938172
b =
    93817284     3817284      817284       17284        7284         284          84
a =
           4          49         493        4938       49381      493817     4938172    49381728
b =
    93817284     3817284      817284       17284        7284         284          84           4
ans =
     1
19
Pass
 
%%
x = 77778
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
       77778
tf_correct =
     1
a =
     6
b =
    49417284
a =
     6    60
b =
    49417284    49417284
a =
     6    60   604
b =
    49417284    49417284     9417284
a =
           6          60         604        6049
b =
    49417284    49417284     9417284      417284
a =
           6          60         604        6049       60494
b =
    49417284    49417284     9417284      417284       17284
a =
           6          60         604        6049       60494      604941
b =
    49417284    49417284     9417284      417284       17284        7284
a =
           6          60         604        6049       60494      604941     6049417
b =
    49417284    49417284     9417284      417284       17284        7284         284
a =
           6          60         604        6049       60494      604941     6049417    60494172
b =
    49417284    49417284     9417284      417284       17284        7284         284          84
a =
  Columns 1 through 8
           6          60         604        6049       60494      604941     6049417    60494172
  Column 9
   604941728
b =
  Columns 1 through 8
    49417284    49417284     9417284      417284       17284        7284         284          84
  Column 9
           4
ans =
     1
20
Pass
 
%%
x = 82656
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
       82656
tf_correct =
     1
a =
     6
b =
   832014336
a =
     6    68
b =
   832014336    32014336
a =
     6    68   683
b =
   832014336    32014336     2014336
a =
           6          68         683        6832
b =
   832014336    32014336     2014336       14336
a =
           6          68         683        6832       68320
b =
   832014336    32014336     2014336       14336       14336
a =
           6          68         683        6832       68320      683201
b =
   832014336    32014336     2014336       14336       14336        4336
a =
           6          68         683        6832       68320      683201     6832014
b =
   832014336    32014336     2014336       14336       14336        4336         336
a =
           6          68         683        6832       68320      683201     6832014    68320143
b =
   832014336    32014336     2014336       14336       14336        4336         336          36
a =
  Columns 1 through 8
           6          68         683        6832       68320      683201     6832014    68320143
  Column 9
   683201433
b =
  Columns 1 through 8
   832014336    32014336     2014336       14336       14336        4336         336          36
  Column 9
           6
ans =
     1
21
Pass
 
%%
x = 95121
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
       95121
tf_correct =
     1
a =
     9
b =
    48004641
a =
     9    90
b =
    48004641    48004641
a =
     9    90   904
b =
    48004641    48004641     8004641
a =
           9          90         904        9048
b =
    48004641    48004641     8004641        4641
a =
           9          90         904        9048       90480
b =
    48004641    48004641     8004641        4641        4641
a =
           9          90         904        9048       90480      904800
b =
    48004641    48004641     8004641        4641        4641        4641
a =
           9          90         904        9048       90480      904800     9048004
b =
    48004641    48004641     8004641        4641        4641        4641         641
a =
           9          90         904        9048       90480      904800     9048004    90480046
b =
    48004641    48004641     8004641        4641        4641        4641         641          41
a =
  Columns 1 through 8
           9          90         904        9048       90480      904800     9048004    90480046
  Column 9
   904800464
b =
  Columns 1 through 8
    48004641    48004641     8004641        4641        4641        4641         641          41
  Column 9
           1
ans =
     1
22
Pass
 
%%
x = 99999
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
       99999
tf_correct =
     1
a =
     9
b =
   999800001
a =
     9    99
b =
   999800001    99800001
a =
     9    99   999
b =
   999800001    99800001     9800001
a =
           9          99         999        9999
b =
   999800001    99800001     9800001      800001
a =
           9          99         999        9999       99998
b =
   999800001    99800001     9800001      800001           1
a =
           9          99         999        9999       99998      999980
b =
   999800001    99800001     9800001      800001           1           1
a =
           9          99         999        9999       99998      999980     9999800
b =
   999800001    99800001     9800001      800001           1           1           1
a =
           9          99         999        9999       99998      999980     9999800    99998000
b =
   999800001    99800001     9800001      800001           1           1           1           1
a =
  Columns 1 through 8
           9          99         999        9999       99998      999980     9999800    99998000
  Column 9
   999980000
b =
  Columns 1 through 8
   999800001    99800001     9800001      800001           1           1           1           1
  Column 9
           1
ans =
     1
23
Pass
 
%%
x = 142857
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      142857
tf_correct =
     1
a =
     2
b =
   408122449
a =
     2    20
b =
   408122449   408122449
a =
     2    20   204
b =
   408122449   408122449     8122449
a =
           2          20         204        2040
b =
   408122449   408122449     8122449     8122449
a =
           2          20         204        2040       20408
b =
   408122449   408122449     8122449     8122449      122449
a =
           2          20         204        2040       20408      204081
b =
   408122449   408122449     8122449     8122449      122449       22449
a =
           2          20         204        2040       20408      204081     2040812
b =
   408122449   408122449     8122449     8122449      122449       22449        2449
a =
           2          20         204        2040       20408      204081     2040812    20408122
b =
   408122449   408122449     8122449     8122449      122449       22449        2449         449
a =
  Columns 1 through 8
           2          20         204        2040       20408      204081     2040812    20408122
  Column 9
   204081224
b =
  Columns 1 through 8
   408122449   408122449     8122449     8122449      122449       22449        2449         449
  Column 9
          49
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0002    0.0020    0.0204    0.2041    2.0408
b =
  Columns 1 through 8
   408122449   408122449     8122449     8122449      122449       22449        2449         449
  Columns 9 through 10
          49           9
ans =
     1
24
Pass
 
%%
x = 148149
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      148149
tf_correct =
     1
a =
     2
b =
   1.9481e+09
a =
     2    21
b =
   1.0e+09 *
    1.9481    0.9481
a =
     2    21   219
b =
   1.0e+09 *
    1.9481    0.9481    0.0481
a =
           2          21         219        2194
b =
   1.0e+09 *
    1.9481    0.9481    0.0481    0.0081
a =
           2          21         219        2194       21948
b =
   1.0e+09 *
    1.9481    0.9481    0.0481    0.0081    0.0001
a =
           2          21         219        2194       21948      219481
b =
   1.0e+09 *
    1.9481    0.9481    0.0481    0.0081    0.0001    0.0000
a =
           2          21         219        2194       21948      219481     2194812
b =
   1.0e+09 *
    1.9481    0.9481    0.0481    0.0081    0.0001    0.0000    0.0000
a =
           2          21         219        2194       21948      219481     2194812    21948126
b =
   1.0e+09 *
    1.9481    0.9481    0.0481    0.0081    0.0001    0.0000    0.0000    0.0000
a =
  Columns 1 through 8
           2          21         219        2194       21948      219481     2194812    21948126
  Column 9
   219481262
b =
   1.0e+09 *
    1.9481    0.9481    0.0481    0.0081    0.0001    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0002    0.0022    0.0219    0.2195    2.1948
b =
   1.0e+09 *
    1.9481    0.9481    0.0481    0.0081    0.0001    0.0000    0.0000    0.0000    0.0000    0.0000
ans =
     1
25
Pass
 
%%
x = 181819
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      181819
tf_correct =
     1
a =
     3
b =
   3.0581e+09
a =
     3    33
b =
   1.0e+09 *
    3.0581    0.0581
a =
     3    33   330
b =
   1.0e+09 *
    3.0581    0.0581    0.0581
a =
           3          33         330        3305
b =
   1.0e+09 *
    3.0581    0.0581    0.0581    0.0081
a =
           3          33         330        3305       33058
b =
   1.0e+09 *
    3.0581    0.0581    0.0581    0.0081    0.0001
a =
           3          33         330        3305       33058      330581
b =
   1.0e+09 *
    3.0581    0.0581    0.0581    0.0081    0.0001    0.0000
a =
           3          33         330        3305       33058      330581     3305814
b =
   1.0e+09 *
    3.0581    0.0581    0.0581    0.0081    0.0001    0.0000    0.0000
a =
           3          33         330        3305       33058      330581     3305814    33058148
b =
   1.0e+09 *
    3.0581    0.0581    0.0581    0.0081    0.0001    0.0000    0.0000    0.0000
a =
  Columns 1 through 8
           3          33         330        3305       33058      330581     3305814    33058148
  Column 9
   330581487
b =
   1.0e+09 *
    3.0581    0.0581    0.0581    0.0081    0.0001    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0003    0.0033    0.0331    0.3306    3.3058
b =
   1.0e+09 *
    3.0581    0.0581    0.0581    0.0081    0.0001    0.0000    0.0000    0.0000    0.0000    0.0000
ans =
     1
26
Pass
 
%%
x = 187110
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      187110
tf_correct =
     1
a =
     3
b =
   5.0102e+09
a =
     3    35
b =
   1.0e+09 *
    5.0102    0.0102
a =
     3    35   350
b =
   1.0e+09 *
    5.0102    0.0102    0.0102
a =
           3          35         350        3501
b =
   1.0e+09 *
    5.0102    0.0102    0.0102    0.0002
a =
           3          35         350        3501       35010
b =
   1.0e+09 *
    5.0102    0.0102    0.0102    0.0002    0.0002
a =
           3          35         350        3501       35010      350101
b =
   1.0e+09 *
    5.0102    0.0102    0.0102    0.0002    0.0002    0.0001
a =
           3          35         350        3501       35010      350101     3501015
b =
   1.0e+09 *
    5.0102    0.0102    0.0102    0.0002    0.0002    0.0001    0.0000
a =
           3          35         350        3501       35010      350101     3501015    35010152
b =
   1.0e+09 *
    5.0102    0.0102    0.0102    0.0002    0.0002    0.0001    0.0000    0.0000
a =
  Columns 1 through 8
           3          35         350        3501       35010      350101     3501015    35010152
  Column 9
   350101521
b =
   1.0e+09 *
    5.0102    0.0102    0.0102    0.0002    0.0002    0.0001    0.0000    0.0000         0
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0004    0.0035    0.0350    0.3501    3.5010
b =
   1.0e+09 *
    5.0102    0.0102    0.0102    0.0002    0.0002    0.0001    0.0000    0.0000         0         0
ans =
     1
27
Pass
 
%%
x = 208495
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      208495
tf_correct =
     1
a =
     4
b =
   3.4702e+09
a =
     4    43
b =
   1.0e+09 *
    3.4702    0.4702
a =
     4    43   434
b =
   1.0e+09 *
    3.4702    0.4702    0.0702
a =
           4          43         434        4347
b =
   1.0e+09 *
    3.4702    0.4702    0.0702    0.0002
a =
           4          43         434        4347       43470
b =
   1.0e+09 *
    3.4702    0.4702    0.0702    0.0002    0.0002
a =
           4          43         434        4347       43470      434701
b =
   1.0e+09 *
    3.4702    0.4702    0.0702    0.0002    0.0002    0.0001
a =
           4          43         434        4347       43470      434701     4347016
b =
   1.0e+09 *
    3.4702    0.4702    0.0702    0.0002    0.0002    0.0001    0.0000
a =
           4          43         434        4347       43470      434701     4347016    43470165
b =
   1.0e+09 *
    3.4702    0.4702    0.0702    0.0002    0.0002    0.0001    0.0000    0.0000
a =
  Columns 1 through 8
           4          43         434        4347       43470      434701     4347016    43470165
  Column 9
   434701650
b =
   1.0e+09 *
    3.4702    0.4702    0.0702    0.0002    0.0002    0.0001    0.0000    0.0000    0.0000
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0004    0.0043    0.0435    0.4347    4.3470
b =
   1.0e+09 *
    3.4702    0.4702    0.0702    0.0002    0.0002    0.0001    0.0000    0.0000    0.0000    0.0000
ans =
     1
28
Pass
 
%%
x = 318682
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      318682
tf_correct =
     1
a =
     1
b =
   1.5582e+09
a =
     1    10
b =
   1.0e+09 *
    1.5582    1.5582
a =
     1    10   101
b =
   1.0e+09 *
    1.5582    1.5582    0.5582
a =
           1          10         101        1015
b =
   1.0e+09 *
    1.5582    1.5582    0.5582    0.0582
a =
           1          10         101        1015       10155
b =
   1.0e+09 *
    1.5582    1.5582    0.5582    0.0582    0.0082
a =
           1          10         101        1015       10155      101558
b =
   1.0e+09 *
    1.5582    1.5582    0.5582    0.0582    0.0082    0.0002
a =
           1          10         101        1015       10155      101558     1015582
b =
   1.0e+09 *
    1.5582    1.5582    0.5582    0.0582    0.0082    0.0002    0.0000
a =
           1          10         101        1015       10155      101558     1015582    10155821
b =
   1.0e+09 *
    1.5582    1.5582    0.5582    0.0582    0.0082    0.0002    0.0000    0.0000
a =
  Columns 1 through 8
           1          10         101        1015       10155      101558     1015582    10155821
  Column 9
   101558217
b =
   1.0e+09 *
    1.5582    1.5582    0.5582    0.0582    0.0082    0.0002    0.0000    0.0000    0.0000
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0001    0.0010    0.0102    0.1016    1.0156
b =
   1.0e+09 *
    1.5582    1.5582    0.5582    0.0582    0.0082    0.0002    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+10 *
  Columns 1 through 10
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0001    0.0010    0.0102    0.1016
  Column 11
    1.0156
b =
   1.0e+09 *
  Columns 1 through 10
    1.5582    1.5582    0.5582    0.0582    0.0082    0.0002    0.0000    0.0000    0.0000    0.0000
  Column 11
    0.0000
ans =
     1
29
Pass
 
%%
x = 329967
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      329967
tf_correct =
     1
a =
     1
b =
   8.8782e+09
a =
     1    10
b =
   1.0e+09 *
    8.8782    8.8782
a =
     1    10   108
b =
   1.0e+09 *
    8.8782    8.8782    0.8782
a =
           1          10         108        1088
b =
   1.0e+09 *
    8.8782    8.8782    0.8782    0.0782
a =
           1          10         108        1088       10887
b =
   1.0e+09 *
    8.8782    8.8782    0.8782    0.0782    0.0082
a =
           1          10         108        1088       10887      108878
b =
   1.0e+09 *
    8.8782    8.8782    0.8782    0.0782    0.0082    0.0002
a =
           1          10         108        1088       10887      108878     1088782
b =
   1.0e+09 *
    8.8782    8.8782    0.8782    0.0782    0.0082    0.0002    0.0000
a =
           1          10         108        1088       10887      108878     1088782    10887822
b =
   1.0e+09 *
    8.8782    8.8782    0.8782    0.0782    0.0082    0.0002    0.0000    0.0000
a =
  Columns 1 through 8
           1          10         108        1088       10887      108878     1088782    10887822
  Column 9
   108878221
b =
   1.0e+09 *
    8.8782    8.8782    0.8782    0.0782    0.0082    0.0002    0.0000    0.0000    0.0000
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0001    0.0011    0.0109    0.1089    1.0888
b =
   1.0e+09 *
    8.8782    8.8782    0.8782    0.0782    0.0082    0.0002    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+10 *
  Columns 1 through 10
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0001    0.0011    0.0109    0.1089
  Column 11
    1.0888
b =
   1.0e+09 *
  Columns 1 through 10
    8.8782    8.8782    0.8782    0.0782    0.0082    0.0002    0.0000    0.0000    0.0000    0.0000
  Column 11
    0.0000
ans =
     1
30
Pass
 
%%
x = 351352
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      351352
tf_correct =
     1
a =
     1
b =
   2.3448e+10
a =
     1    12
b =
   1.0e+10 *
    2.3448    0.3448
a =
     1    12   123
b =
   1.0e+10 *
    2.3448    0.3448    0.0448
a =
           1          12         123        1234
b =
   1.0e+10 *
    2.3448    0.3448    0.0448    0.0048
a =
           1          12         123        1234       12344
b =
   1.0e+10 *
    2.3448    0.3448    0.0448    0.0048    0.0008
a =
           1          12         123        1234       12344      123448
b =
   1.0e+10 *
    2.3448    0.3448    0.0448    0.0048    0.0008    0.0000
a =
           1          12         123        1234       12344      123448     1234482
b =
   1.0e+10 *
    2.3448    0.3448    0.0448    0.0048    0.0008    0.0000    0.0000
a =
           1          12         123        1234       12344      123448     1234482    12344822
b =
   1.0e+10 *
    2.3448    0.3448    0.0448    0.0048    0.0008    0.0000    0.0000    0.0000
a =
  Columns 1 through 8
           1          12         123        1234       12344      123448     1234482    12344822
  Column 9
   123448227
b =
   1.0e+10 *
    2.3448    0.3448    0.0448    0.0048    0.0008    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0001    0.0012    0.0123    0.1234    1.2345
b =
   1.0e+10 *
    2.3448    0.3448    0.0448    0.0048    0.0008    0.0000    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+10 *
  Columns 1 through 10
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0001    0.0012    0.0123    0.1234
  Column 11
    1.2345
b =
   1.0e+10 *
  Columns 1 through 10
    2.3448    0.3448    0.0448    0.0048    0.0008    0.0000    0.0000    0.0000    0.0000    0.0000
  Column 11
    0.0000
ans =
     1
31
Pass
 
%%
x = 356643
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      356643
tf_correct =
     1
a =
     1
b =
   2.7194e+10
a =
     1    12
b =
   1.0e+10 *
    2.7194    0.7194
a =
     1    12   127
b =
   1.0e+10 *
    2.7194    0.7194    0.0194
a =
           1          12         127        1271
b =
   1.0e+10 *
    2.7194    0.7194    0.0194    0.0094
a =
           1          12         127        1271       12719
b =
   1.0e+10 *
    2.7194    0.7194    0.0194    0.0094    0.0004
a =
           1          12         127        1271       12719      127194
b =
   1.0e+10 *
    2.7194    0.7194    0.0194    0.0094    0.0004    0.0000
a =
           1          12         127        1271       12719      127194     1271942
b =
   1.0e+10 *
    2.7194    0.7194    0.0194    0.0094    0.0004    0.0000    0.0000
a =
           1          12         127        1271       12719      127194     1271942    12719422
b =
   1.0e+10 *
    2.7194    0.7194    0.0194    0.0094    0.0004    0.0000    0.0000    0.0000
a =
  Columns 1 through 8
           1          12         127        1271       12719      127194     1271942    12719422
  Column 9
   127194229
b =
   1.0e+10 *
    2.7194    0.7194    0.0194    0.0094    0.0004    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0001    0.0013    0.0127    0.1272    1.2719
b =
   1.0e+10 *
    2.7194    0.7194    0.0194    0.0094    0.0004    0.0000    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+10 *
  Columns 1 through 10
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0001    0.0013    0.0127    0.1272
  Column 11
    1.2719
b =
   1.0e+10 *
  Columns 1 through 10
    2.7194    0.7194    0.0194    0.0094    0.0004    0.0000    0.0000    0.0000    0.0000    0.0000
  Column 11
    0.0000
ans =
     1
32
Pass
 
%%
x = 390313
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      390313
tf_correct =
     1
a =
     1
b =
   5.2344e+10
a =
     1    15
b =
   1.0e+10 *
    5.2344    0.2344
a =
     1    15   152
b =
   1.0e+10 *
    5.2344    0.2344    0.0344
a =
           1          15         152        1523
b =
   1.0e+10 *
    5.2344    0.2344    0.0344    0.0044
a =
           1          15         152        1523       15234
b =
   1.0e+10 *
    5.2344    0.2344    0.0344    0.0044    0.0004
a =
           1          15         152        1523       15234      152344
b =
   1.0e+10 *
    5.2344    0.2344    0.0344    0.0044    0.0004    0.0000
a =
           1          15         152        1523       15234      152344     1523442
b =
   1.0e+10 *
    5.2344    0.2344    0.0344    0.0044    0.0004    0.0000    0.0000
a =
           1          15         152        1523       15234      152344     1523442    15234423
b =
   1.0e+10 *
    5.2344    0.2344    0.0344    0.0044    0.0004    0.0000    0.0000    0.0000
a =
  Columns 1 through 8
           1          15         152        1523       15234      152344     1523442    15234423
  Column 9
   152344237
b =
   1.0e+10 *
    5.2344    0.2344    0.0344    0.0044    0.0004    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0002    0.0015    0.0152    0.1523    1.5234
b =
   1.0e+10 *
    5.2344    0.2344    0.0344    0.0044    0.0004    0.0000    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+10 *
  Columns 1 through 10
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0002    0.0015    0.0152    0.1523
  Column 11
    1.5234
b =
   1.0e+10 *
  Columns 1 through 10
    5.2344    0.2344    0.0344    0.0044    0.0004    0.0000    0.0000    0.0000    0.0000    0.0000
  Column 11
    0.0000
ans =
     1
33
Pass
 
%%
x = 461539
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      461539
tf_correct =
     1
a =
     2
b =
   1.3018e+10
a =
     2    21
b =
   1.0e+10 *
    1.3018    0.3018
a =
     2    21   213
b =
   1.0e+10 *
    1.3018    0.3018    0.0018
a =
           2          21         213        2130
b =
   1.0e+10 *
    1.3018    0.3018    0.0018    0.0018
a =
           2          21         213        2130       21301
b =
   1.0e+10 *
    1.3018    0.3018    0.0018    0.0018    0.0008
a =
           2          21         213        2130       21301      213018
b =
   1.0e+10 *
    1.3018    0.3018    0.0018    0.0018    0.0008    0.0000
a =
           2          21         213        2130       21301      213018     2130182
b =
   1.0e+10 *
    1.3018    0.3018    0.0018    0.0018    0.0008    0.0000    0.0000
a =
           2          21         213        2130       21301      213018     2130182    21301824
b =
   1.0e+10 *
    1.3018    0.3018    0.0018    0.0018    0.0008    0.0000    0.0000    0.0000
a =
  Columns 1 through 8
           2          21         213        2130       21301      213018     2130182    21301824
  Column 9
   213018248
b =
   1.0e+10 *
    1.3018    0.3018    0.0018    0.0018    0.0008    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0002    0.0021    0.0213    0.2130    2.1302
b =
   1.0e+10 *
    1.3018    0.3018    0.0018    0.0018    0.0008    0.0000    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+10 *
  Columns 1 through 10
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0002    0.0021    0.0213    0.2130
  Column 11
    2.1302
b =
   1.0e+10 *
  Columns 1 through 10
    1.3018    0.3018    0.0018    0.0018    0.0008    0.0000    0.0000    0.0000    0.0000    0.0000
  Column 11
    0.0000
ans =
     1
34
Pass
 
%%
x = 466830
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      466830
tf_correct =
     1
a =
     2
b =
   1.7930e+10
a =
     2    21
b =
   1.0e+10 *
    1.7930    0.7930
a =
     2    21   217
b =
   1.0e+10 *
    1.7930    0.7930    0.0930
a =
           2          21         217        2179
b =
   1.0e+10 *
    1.7930    0.7930    0.0930    0.0030
a =
           2          21         217        2179       21793
b =
   1.0e+10 *
    1.7930    0.7930    0.0930    0.0030    0.0000
a =
           2          21         217        2179       21793      217930
b =
   1.0e+10 *
    1.7930    0.7930    0.0930    0.0030    0.0000    0.0000
a =
           2          21         217        2179       21793      217930     2179302
b =
   1.0e+10 *
    1.7930    0.7930    0.0930    0.0030    0.0000    0.0000    0.0000
a =
           2          21         217        2179       21793      217930     2179302    21793024
b =
   1.0e+10 *
    1.7930    0.7930    0.0930    0.0030    0.0000    0.0000    0.0000    0.0000
a =
  Columns 1 through 8
           2          21         217        2179       21793      217930     2179302    21793024
  Column 9
   217930248
b =
   1.0e+10 *
    1.7930    0.7930    0.0930    0.0030    0.0000    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0002    0.0022    0.0218    0.2179    2.1793
b =
   1.0e+10 *
    1.7930    0.7930    0.0930    0.0030    0.0000    0.0000    0.0000    0.0000    0.0000         0
a =
   1.0e+10 *
  Columns 1 through 10
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0002    0.0022    0.0218    0.2179
  Column 11
    2.1793
b =
   1.0e+10 *
  Columns 1 through 10
    1.7930    0.7930    0.0930    0.0030    0.0000    0.0000    0.0000    0.0000    0.0000         0
  Column 11
         0
ans =
     1
35
Pass
 
%%
x = 499500
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      499500
tf_correct =
     1
a =
     2
b =
   4.9500e+10
a =
     2    24
b =
   1.0e+10 *
    4.9500    0.9500
a =
     2    24   249
b =
   1.0e+10 *
    4.9500    0.9500    0.0500
a =
           2          24         249        2495
b =
   1.0e+10 *
    4.9500    0.9500    0.0500    0.0000
a =
           2          24         249        2495       24950
b =
   1.0e+10 *
    4.9500    0.9500    0.0500    0.0000    0.0000
a =
           2          24         249        2495       24950      249500
b =
   1.0e+10 *
    4.9500    0.9500    0.0500    0.0000    0.0000    0.0000
a =
           2          24         249        2495       24950      249500     2495002
b =
   1.0e+10 *
    4.9500    0.9500    0.0500    0.0000    0.0000    0.0000    0.0000
a =
           2          24         249        2495       24950      249500     2495002    24950025
b =
   1.0e+10 *
    4.9500    0.9500    0.0500    0.0000    0.0000    0.0000    0.0000         0
a =
  Columns 1 through 8
           2          24         249        2495       24950      249500     2495002    24950025
  Column 9
   249500250
b =
   1.0e+10 *
    4.9500    0.9500    0.0500    0.0000    0.0000    0.0000    0.0000         0         0
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0002    0.0025    0.0250    0.2495    2.4950
b =
   1.0e+10 *
    4.9500    0.9500    0.0500    0.0000    0.0000    0.0000    0.0000         0         0         0
a =
   1.0e+10 *
  Columns 1 through 10
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0002    0.0025    0.0250    0.2495
  Column 11
    2.4950
b =
   1.0e+10 *
  Columns 1 through 10
    4.9500    0.9500    0.0500    0.0000    0.0000    0.0000    0.0000         0         0         0
  Column 11
         0
ans =
     1
36
Pass
 
%%
x = 500500
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      500500
tf_correct =
     1
a =
     2
b =
   5.0500e+10
a =
     2    25
b =
   1.0e+10 *
    5.0500    0.0500
a =
     2    25   250
b =
   1.0e+10 *
    5.0500    0.0500    0.0500
a =
           2          25         250        2505
b =
   1.0e+10 *
    5.0500    0.0500    0.0500    0.0000
a =
           2          25         250        2505       25050
b =
   1.0e+10 *
    5.0500    0.0500    0.0500    0.0000    0.0000
a =
           2          25         250        2505       25050      250500
b =
   1.0e+10 *
    5.0500    0.0500    0.0500    0.0000    0.0000    0.0000
a =
           2          25         250        2505       25050      250500     2505002
b =
   1.0e+10 *
    5.0500    0.0500    0.0500    0.0000    0.0000    0.0000    0.0000
a =
           2          25         250        2505       25050      250500     2505002    25050025
b =
   1.0e+10 *
    5.0500    0.0500    0.0500    0.0000    0.0000    0.0000    0.0000         0
a =
  Columns 1 through 8
           2          25         250        2505       25050      250500     2505002    25050025
  Column 9
   250500250
b =
   1.0e+10 *
    5.0500    0.0500    0.0500    0.0000    0.0000    0.0000    0.0000         0         0
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0003    0.0025    0.0251    0.2505    2.5050
b =
   1.0e+10 *
    5.0500    0.0500    0.0500    0.0000    0.0000    0.0000    0.0000         0         0         0
a =
   1.0e+10 *
  Columns 1 through 10
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0003    0.0025    0.0251    0.2505
  Column 11
    2.5050
b =
   1.0e+10 *
  Columns 1 through 10
    5.0500    0.0500    0.0500    0.0000    0.0000    0.0000    0.0000         0         0         0
  Column 11
         0
ans =
     1
37
Pass
 
%%
x = 533170
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      533170
tf_correct =
     1
a =
     2
b =
   8.4270e+10
a =
     2    28
b =
   1.0e+10 *
    8.4270    0.4270
a =
     2    28   284
b =
   1.0e+10 *
    8.4270    0.4270    0.0270
a =
           2          28         284        2842
b =
   1.0e+10 *
    8.4270    0.4270    0.0270    0.0070
a =
           2          28         284        2842       28427
b =
   1.0e+10 *
    8.4270    0.4270    0.0270    0.0070    0.0000
a =
           2          28         284        2842       28427      284270
b =
   1.0e+10 *
    8.4270    0.4270    0.0270    0.0070    0.0000    0.0000
a =
           2          28         284        2842       28427      284270     2842702
b =
   1.0e+10 *
    8.4270    0.4270    0.0270    0.0070    0.0000    0.0000    0.0000
a =
           2          28         284        2842       28427      284270     2842702    28427024
b =
   1.0e+10 *
    8.4270    0.4270    0.0270    0.0070    0.0000    0.0000    0.0000    0.0000
a =
  Columns 1 through 8
           2          28         284        2842       28427      284270     2842702    28427024
  Column 9
   284270248
b =
   1.0e+10 *
    8.4270    0.4270    0.0270    0.0070    0.0000    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0003    0.0028    0.0284    0.2843    2.8427
b =
   1.0e+10 *
    8.4270    0.4270    0.0270    0.0070    0.0000    0.0000    0.0000    0.0000    0.0000         0
a =
   1.0e+10 *
  Columns 1 through 10
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0003    0.0028    0.0284    0.2843
  Column 11
    2.8427
b =
   1.0e+10 *
  Columns 1 through 10
    8.4270    0.4270    0.0270    0.0070    0.0000    0.0000    0.0000    0.0000    0.0000         0
  Column 11
         0
ans =
     1
38
Pass
 
%%
x = 538461
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      538461
tf_correct =
     1
a =
     2
b =
   8.9940e+10
a =
     2    28
b =
   1.0e+10 *
    8.9940    0.9940
a =
     2    28   289
b =
   1.0e+10 *
    8.9940    0.9940    0.0940
a =
           2          28         289        2899
b =
   1.0e+10 *
    8.9940    0.9940    0.0940    0.0040
a =
           2          28         289        2899       28994
b =
   1.0e+10 *
    8.9940    0.9940    0.0940    0.0040    0.0000
a =
           2          28         289        2899       28994      289940
b =
   1.0e+10 *
    8.9940    0.9940    0.0940    0.0040    0.0000    0.0000
a =
           2          28         289        2899       28994      289940     2899402
b =
   1.0e+10 *
    8.9940    0.9940    0.0940    0.0040    0.0000    0.0000    0.0000
a =
           2          28         289        2899       28994      289940     2899402    28994024
b =
   1.0e+10 *
    8.9940    0.9940    0.0940    0.0040    0.0000    0.0000    0.0000    0.0000
a =
  Columns 1 through 8
           2          28         289        2899       28994      289940     2899402    28994024
  Column 9
   289940248
b =
   1.0e+10 *
    8.9940    0.9940    0.0940    0.0040    0.0000    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0003    0.0029    0.0290    0.2899    2.8994
b =
   1.0e+10 *
    8.9940    0.9940    0.0940    0.0040    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+10 *
  Columns 1 through 10
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0003    0.0029    0.0290    0.2899
  Column 11
    2.8994
b =
   1.0e+10 *
  Columns 1 through 10
    8.9940    0.9940    0.0940    0.0040    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
  Column 11
    0.0000
ans =
     1
39
Pass
 
%%
x = 609687
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      609687
tf_correct =
     1
a =
     3
b =
   7.1718e+10
a =
     3    37
b =
   1.0e+10 *
    7.1718    0.1718
a =
     3    37   371
b =
   1.0e+10 *
    7.1718    0.1718    0.0718
a =
           3          37         371        3717
b =
   1.0e+10 *
    7.1718    0.1718    0.0718    0.0018
a =
           3          37         371        3717       37171
b =
   1.0e+10 *
    7.1718    0.1718    0.0718    0.0018    0.0008
a =
           3          37         371        3717       37171      371718
b =
   1.0e+10 *
    7.1718    0.1718    0.0718    0.0018    0.0008    0.0000
a =
           3          37         371        3717       37171      371718     3717182
b =
   1.0e+10 *
    7.1718    0.1718    0.0718    0.0018    0.0008    0.0000    0.0000
a =
           3          37         371        3717       37171      371718     3717182    37171823
b =
   1.0e+10 *
    7.1718    0.1718    0.0718    0.0018    0.0008    0.0000    0.0000    0.0000
a =
  Columns 1 through 8
           3          37         371        3717       37171      371718     3717182    37171823
  Column 9
   371718237
b =
   1.0e+10 *
    7.1718    0.1718    0.0718    0.0018    0.0008    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0004    0.0037    0.0372    0.3717    3.7172
b =
   1.0e+10 *
    7.1718    0.1718    0.0718    0.0018    0.0008    0.0000    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+10 *
  Columns 1 through 10
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0004    0.0037    0.0372    0.3717
  Column 11
    3.7172
b =
   1.0e+10 *
  Columns 1 through 10
    7.1718    0.1718    0.0718    0.0018    0.0008    0.0000    0.0000    0.0000    0.0000    0.0000
  Column 11
    0.0000
ans =
     1
40
Pass
 
%%
x = 643357
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      643357
tf_correct =
     1
a =
     4
b =
   1.3908e+10
a =
     4    41
b =
   1.0e+10 *
    1.3908    0.3908
a =
     4    41   413
b =
   1.0e+10 *
    1.3908    0.3908    0.0908
a =
           4          41         413        4139
b =
   1.0e+10 *
    1.3908    0.3908    0.0908    0.0008
a =
           4          41         413        4139       41390
b =
   1.0e+10 *
    1.3908    0.3908    0.0908    0.0008    0.0008
a =
           4          41         413        4139       41390      413908
b =
   1.0e+10 *
    1.3908    0.3908    0.0908    0.0008    0.0008    0.0000
a =
           4          41         413        4139       41390      413908     4139082
b =
   1.0e+10 *
    1.3908    0.3908    0.0908    0.0008    0.0008    0.0000    0.0000
a =
           4          41         413        4139       41390      413908     4139082    41390822
b =
   1.0e+10 *
    1.3908    0.3908    0.0908    0.0008    0.0008    0.0000    0.0000    0.0000
a =
  Columns 1 through 8
           4          41         413        4139       41390      413908     4139082    41390822
  Column 9
   413908229
b =
   1.0e+10 *
    1.3908    0.3908    0.0908    0.0008    0.0008    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0004    0.0041    0.0414    0.4139    4.1391
b =
   1.0e+10 *
    1.3908    0.3908    0.0908    0.0008    0.0008    0.0000    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+10 *
  Columns 1 through 10
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0004    0.0041    0.0414    0.4139
  Column 11
    4.1391
b =
   1.0e+10 *
  Columns 1 through 10
    1.3908    0.3908    0.0908    0.0008    0.0008    0.0000    0.0000    0.0000    0.0000    0.0000
  Column 11
    0.0000
ans =
     1
41
Pass
 
%%
x = 648648
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      648648
tf_correct =
     1
a =
     4
b =
   2.0744e+10
a =
     4    42
b =
   1.0e+10 *
    2.0744    0.0744
a =
     4    42   420
b =
   1.0e+10 *
    2.0744    0.0744    0.0744
a =
           4          42         420        4207
b =
   1.0e+10 *
    2.0744    0.0744    0.0744    0.0044
a =
           4          42         420        4207       42074
b =
   1.0e+10 *
    2.0744    0.0744    0.0744    0.0044    0.0004
a =
           4          42         420        4207       42074      420744
b =
   1.0e+10 *
    2.0744    0.0744    0.0744    0.0044    0.0004    0.0000
a =
           4          42         420        4207       42074      420744     4207442
b =
   1.0e+10 *
    2.0744    0.0744    0.0744    0.0044    0.0004    0.0000    0.0000
a =
           4          42         420        4207       42074      420744     4207442    42074422
b =
   1.0e+10 *
    2.0744    0.0744    0.0744    0.0044    0.0004    0.0000    0.0000    0.0000
a =
  Columns 1 through 8
           4          42         420        4207       42074      420744     4207442    42074422
  Column 9
   420744227
b =
   1.0e+10 *
    2.0744    0.0744    0.0744    0.0044    0.0004    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0004    0.0042    0.0421    0.4207    4.2074
b =
   1.0e+10 *
    2.0744    0.0744    0.0744    0.0044    0.0004    0.0000    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+10 *
  Columns 1 through 10
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0004    0.0042    0.0421    0.4207
  Column 11
    4.2074
b =
   1.0e+10 *
  Columns 1 through 10
    2.0744    0.0744    0.0744    0.0044    0.0004    0.0000    0.0000    0.0000    0.0000    0.0000
  Column 11
    0.0000
ans =
     1
42
Pass
 
%%
x = 670033
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      670033
tf_correct =
     1
a =
     4
b =
   4.8944e+10
a =
     4    44
b =
   1.0e+10 *
    4.8944    0.8944
a =
     4    44   448
b =
   1.0e+10 *
    4.8944    0.8944    0.0944
a =
           4          44         448        4489
b =
   1.0e+10 *
    4.8944    0.8944    0.0944    0.0044
a =
           4          44         448        4489       44894
b =
   1.0e+10 *
    4.8944    0.8944    0.0944    0.0044    0.0004
a =
           4          44         448        4489       44894      448944
b =
   1.0e+10 *
    4.8944    0.8944    0.0944    0.0044    0.0004    0.0000
a =
           4          44         448        4489       44894      448944     4489442
b =
   1.0e+10 *
    4.8944    0.8944    0.0944    0.0044    0.0004    0.0000    0.0000
a =
           4          44         448        4489       44894      448944     4489442    44894422
b =
   1.0e+10 *
    4.8944    0.8944    0.0944    0.0044    0.0004    0.0000    0.0000    0.0000
a =
  Columns 1 through 8
           4          44         448        4489       44894      448944     4489442    44894422
  Column 9
   448944221
b =
   1.0e+10 *
    4.8944    0.8944    0.0944    0.0044    0.0004    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0004    0.0045    0.0449    0.4489    4.4894
b =
   1.0e+10 *
    4.8944    0.8944    0.0944    0.0044    0.0004    0.0000    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+10 *
  Columns 1 through 10
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0004    0.0045    0.0449    0.4489
  Column 11
    4.4894
b =
   1.0e+10 *
  Columns 1 through 10
    4.8944    0.8944    0.0944    0.0044    0.0004    0.0000    0.0000    0.0000    0.0000    0.0000
  Column 11
    0.0000
ans =
     1
43
Pass
 
%%
x = 681318
tf_correct = true
assert(isequal(kap(x),tf_correct))
x =
      681318
tf_correct =
     1
a =
     4
b =
   6.4194e+10
a =
     4    46
b =
   1.0e+10 *
    6.4194    0.4194
a =
     4    46   464
b =
   1.0e+10 *
    6.4194    0.4194    0.0194
a =
           4          46         464        4641
b =
   1.0e+10 *
    6.4194    0.4194    0.0194    0.0094
a =
           4          46         464        4641       46419
b =
   1.0e+10 *
    6.4194    0.4194    0.0194    0.0094    0.0004
a =
           4          46         464        4641       46419      464194
b =
   1.0e+10 *
    6.4194    0.4194    0.0194    0.0094    0.0004    0.0000
a =
           4          46         464        4641       46419      464194     4641942
b =
   1.0e+10 *
    6.4194    0.4194    0.0194    0.0094    0.0004    0.0000    0.0000
a =
           4          46         464        4641       46419      464194     4641942    46419421
b =
   1.0e+10 *
    6.4194    0.4194    0.0194    0.0094    0.0004    0.0000    0.0000    0.0000
a =
  Columns 1 through 8
           4          46         464        4641       46419      464194     4641942    46419421
  Column 9
   464194217
b =
   1.0e+10 *
    6.4194    0.4194    0.0194    0.0094    0.0004    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0005    0.0046    0.0464    0.4642    4.6419
b =
   1.0e+10 *
    6.4194    0.4194    0.0194    0.0094    0.0004    0.0000    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+10 *
  Columns 1 through 10
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0005    0.0046    0.0464    0.4642
  Column 11
    4.6419
b =
   1.0e+10 *
  Columns 1 through 10
    6.4194    0.4194    0.0194    0.0094    0.0004    0.0000    0.0000    0.0000    0.0000    0.0000
  Column 11
    0.0000
ans =
     1
44
Pass
 
%%
x = 681319
tf_correct = false
assert(isequal(kap(x),tf_correct))
x =
      681319
tf_correct =
     0
a =
     4
b =
   6.4196e+10
a =
     4    46
b =
   1.0e+10 *
    6.4196    0.4196
a =
     4    46   464
b =
   1.0e+10 *
    6.4196    0.4196    0.0196
a =
           4          46         464        4641
b =
   1.0e+10 *
    6.4196    0.4196    0.0196    0.0096
a =
           4          46         464        4641       46419
b =
   1.0e+10 *
    6.4196    0.4196    0.0196    0.0096    0.0006
a =
           4          46         464        4641       46419      464195
b =
   1.0e+10 *
    6.4196    0.4196    0.0196    0.0096    0.0006    0.0001
a =
           4          46         464        4641       46419      464195     4641955
b =
   1.0e+10 *
    6.4196    0.4196    0.0196    0.0096    0.0006    0.0001    0.0000
a =
           4          46         464        4641       46419      464195     4641955    46419557
b =
   1.0e+10 *
    6.4196    0.4196    0.0196    0.0096    0.0006    0.0001    0.0000    0.0000
a =
  Columns 1 through 8
           4          46         464        4641       46419      464195     4641955    46419557
  Column 9
   464195579
b =
   1.0e+10 *
    6.4196    0.4196    0.0196    0.0096    0.0006    0.0001    0.0000    0.0000    0.0000
a =
   1.0e+09 *
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0005    0.0046    0.0464    0.4642    4.6420
b =
   1.0e+10 *
    6.4196    0.4196    0.0196    0.0096    0.0006    0.0001    0.0000    0.0000    0.0000    0.0000
a =
   1.0e+10 *
  Columns 1 through 10
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0005    0.0046    0.0464    0.4642
  Column 11
    4.6420
b =
   1.0e+10 *
  Columns 1 through 10
    6.4196    0.4196    0.0196    0.0096    0.0006    0.0001    0.0000    0.0000    0.0000    0.0000
  Column 11
    0.0000
ans =
     0
45
Fail
 
%%
x = 681320
tf_correct = false
assert(isequal(kap(x),tf_correct))
x =
      681320
tf_correct =
     0
a =
     4
b =
   6.4197e+10
a =
     4    46
b =
   1.0e+10 *
    6.4197    0.4197
a =
     4    46   464
b =
   1.0e+10 *
    6.4197    0.4197    0.0197
a =
           4          46         464        4641
b =
   1.0e+10 *
    6.4197    0.4197    0.0197    0.0097
a =
           4          46         464        4641       46419
b =
   1.0e+10 *
    6.4197    0.4197    0.0197    0.0097    0.0007
a =
           4          46         464        4641       46419      464196
b =
   1.0e+10 *
    6.4197    0.4197    0.0197    0.0097    0.0007    0.0001
a =
           4          46         464        4641       46419      464196     4641969
b =
   1.0e+10 *
    6.4197    0.4197    0.0197    0.0097    0.0007    0.0001    0.0000
a =
           4          46         464        4641       46419      464196     4641969