Cody

Solution 997575

Submitted on 6 Oct 2016 by Massimo Zanetti
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
A = 1; iterations = 4; y_correct8 = [1 3 7 15 31]; assert(isequal(your_fcn_name(A,iterations),y_correct8))

A = 1 3 A = 1 3 7 A = 1 3 7 15 A = 1 3 7 15 31

2   Pass
A = 1; iterations = 1000; C= A for i = 1:iterations C(i+1) = 2*C(i)+1; end assert(isequal(your_fcn_name(A,iterations),C))

C = 1 A = 1 3 A = 1 3 7 A = 1 3 7 15 A = 1 3 7 15 31 A = 1 3 7 15 31 63 A = 1 3 7 15 31 63 127 A = 1 3 7 15 31 63 127 255 A = 1 3 7 15 31 63 127 255 511 A = Columns 1 through 8 1 3 7 15 31 63 127 255 Columns 9 through 10 511 1023 A = Columns 1 through 8 1 3 7 15 31 63 127 255 Columns 9 through 11 511 1023 2047 A = Columns 1 through 8 1 3 7 15 31 63 127 255 Columns 9 through 12 511 1023 2047 4095 A = Columns 1 through 8 1 3 7 15 31 63 127 255 Columns 9 through 13 511 1023 2047 4095 8191 A = Columns 1 through 8 1 3 7 15 31 63 127 255 Columns 9 through 14 511 1023 2047 4095 8191 16383 A = Columns 1 through 8 1 3 7 15 31 63 127 255 Columns 9 through 15 511 1023 2047 4095 8191 16383 32767 A = Columns 1 through 8 1 3 7 15 31 63 127 255 Columns 9 through 16 511 1023 2047 4095 8191 16383 32767 65535 A = Columns 1 through 8 1 3 7 15 31 63 127 255 Columns 9 through 16 511 1023 2047 4095 8191 16383 32767 65535 Column 17 131071 A = Columns 1 through 8 1 3 7 15 31 63 127 255 Columns 9 through 16 511 1023 2047 4095 8191 16383 32767 65535 Columns 17 through 18 131071 262143 A = Columns 1 through 8 1 3 7 15 31 63 127 255 Columns 9 through 16 511 1023 2047 4095 8191 16383 32767 65535 Columns 17 through 19 131071 262143 524287 A = Columns 1 through 8 1 3 7 15 31 63 127 255 Columns 9 through 16 511 1023 2047 4095 8191 16383 32767 65535 Columns 17 through 20 131071 262143 524287 1048575 A = Columns 1 through 8 1 3 7 15 31 63 127 255 Columns 9 through 16 511 1023 2047 4095 8191 16383 32767 65535 Columns 17 through 21 131071 262143 524287 1048575 2097151 A = Columns 1 through 8 1 3 7 15 31 63 127 255 Columns 9 through 16 511 1023 2047 4095 8191 16383 32767 65535 Columns 17 through 22 131071 262143 524287 1048575 2097151 4194303 A = Columns 1 through 8 1 3 7 15 31 63 127 255 Columns 9 through 16 511 1023 2047 4095 8191 16383 32767 65535 Columns 17 through 23 131071 262143 524287 1048575 2097151 4194303 8388607 A = Columns 1 through 8 1 3 7 15 31 63 127 255 Columns 9 through 16 511 1023 2047 4095 8191 16383 32767 65535 Columns 17 through 24 131071 262143 524287 1048575 2097151 4194303 8388607 16777215 A = Columns 1 through 8 1 3 7 15 31 63 127 255 Columns 9 through 16 511 1023 2047 4095 8191 16383 32767 65535 Columns 17 through 24 131071 262143 524287 1048575 2097151 4194303 8388607 16777215 Column 25 33554431 A = Columns 1 through 8 1 3 7 15 31 63 127 255 Columns 9 through 16 511 1023 2047 4095 8191 16383 32767 65535 Columns 17 through 24 131071 262143 524287 1048575 2097151 4194303 8388607 16777215 Columns 25 through 26 33554431 67108863 A = Columns 1 through 8 1 3 7 15 31 63 127 255 Columns 9 through 16 511 1023 2047 4095 8191 16383 32767 65535 Columns 17 through 24 131071 262143 524287 1048575 2097151 4194303 8388607 16777215 Columns 25 through 27 33554431 67108863 134217727 A = Columns 1 through 8 1 3 7 15 31 63 127 255 Columns 9 through 16 511 1023 2047 4095 8191 16383 32767 65535 Columns 17 through 24 131071 262143 524287 1048575 2097151 4194303 8388607 16777215 Columns 25 through 28 33554431 67108863 134217727 268435455 A = Columns 1 through 8 1 3 7 15 31 63 127 255 Columns 9 through 16 511 1023 2047 4095 8191 16383 32767 65535 Columns 17 through 24 131071 262143 524287 1048575 2097151 4194303 8388607 16777215 Columns 25 through 29 33554431 67108863 134217727 268435455 536870911 A = 1.0e+09 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 10 through 18 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0001 0.0003 Columns 19 through 27 0.0005 0.0010 0.0021 0.0042 0.0084 0.0168 0.0336 0.0671 0.1342 Columns 28 through 30 0.2684 0.5369 1.0737 A = 1.0e+09 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 10 through 18 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0001 0.0003 Columns 19 through 27 0.0005 0.0010 0.0021 0.0042 0.0084 0.0168 0.0336 0.0671 0.1342 Columns 28 through 31 0.2684 0.5369 1.0737 2.1475 A = 1.0e+09 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 10 through 18 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0001 0.0003 Columns 19 through 27 0.0005 0.0010 0.0021 0.0042 0.0084 0.0168 0.0336 0.0671 0.1342 Columns 28 through 32 0.2684 0.5369 1.0737 2.1475 4.2950 A = 1.0e+09 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 10 through 18 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0001 0.0003 Columns 19 through 27 0.0005 0.0010 0.0021 0.0042 0.0084 0.0168 0.0336 0.0671 0.1342 Columns 28 through 33 0.2684 0.5369 1.0737 2.1475 4.2950 8.5899 A = 1.0e+10 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 10 through 18 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 19 through 27 0.0001 0.0001 0.0002 0.0004 0.0008 0.0017 0.0034 0.0067 0.0134 Columns 28 through 34 0.0268 0.0537 0.1074 0.2147 0.4295 0.8590 1.7180 A = 1.0e+10 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 10 through 18 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 19 through 27 0.0001 0.0001 0.0002 0.0004 0.0008 0.0017 0.0034 0.0067 0.0134 Columns 28 through 35 0.0268 0.0537 0.1074 0.2147 0.4295 0.8590 1.7180 3.4360 A = 1.0e+10 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 10 through 18 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 19 through 27 0.0001 0.0001 0.0002 0.0004 0.0008 0.0017 0.0034 0.0067 0.0134 Columns 28 through 36 0.0268 0.0537 0.1074 0.2147 0.4295 0.8590 1.7180 3.4360 6.8719 A = 1.0e+11 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 10 through 18 0.0000 0.0000 0...