Cody

# Problem 54. Maximum running product for a string of numbers

Solution 1910396

Submitted on 23 Aug 2019 by Tetsuji Tsuda
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
s = '123454321'; i_correct = 3; assert(isequal(running_product(s),i_correct))

n = [] l = 9 n = 1 n = 1 2 n = 1 2 3 n = 1 2 3 4 n = 1 2 3 4 5 n = 1 2 3 4 5 4 n = 1 2 3 4 5 4 3 n = 1 2 3 4 5 4 3 2 n = 1 2 3 4 5 4 3 2 1 pr = [] pr = 120 pr = 120 480 pr = 120 480 720 pr = 120 480 720 480 pr = 120 480 720 480 120 val = 720 idx = 3 i = 3

2   Pass
s = '5820974944592307816406286208998628034825342117067'; i_correct = 28; assert(isequal(running_product(s),i_correct))

n = [] l = 49 n = 5 n = 5 8 n = 5 8 2 n = 5 8 2 0 n = 5 8 2 0 9 n = 5 8 2 0 9 7 n = 5 8 2 0 9 7 4 n = 5 8 2 0 9 7 4 9 n = 5 8 2 0 9 7 4 9 4 n = 5 8 2 0 9 7 4 9 4 4 n = 5 8 2 0 9 7 4 9 4 4 5 n = 5 8 2 0 9 7 4 9 4 4 5 9 n = 5 8 2 0 9 7 4 9 4 4 5 9 2 n = 5 8 2 0 9 7 4 9 4 4 5 9 2 3 n = 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 n = 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 n = 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 n = 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 n = 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 n = 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 n = 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 n = 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 n = 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 n = 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 n = 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 n = 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 n = 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 n = 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 n = 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 n = 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 n = Columns 1 through 30 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 Column 31 8 n = Columns 1 through 30 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 Columns 31 through 32 8 6 n = Columns 1 through 30 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 Columns 31 through 33 8 6 2 n = Columns 1 through 30 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 Columns 31 through 34 8 6 2 8 n = Columns 1 through 30 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 Columns 31 through 35 8 6 2 8 0 n = Columns 1 through 30 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 Columns 31 through 36 8 6 2 8 0 3 n = Columns 1 through 30 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 Columns 31 through 37 8 6 2 8 0 3 4 n = Columns 1 through 30 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 Columns 31 through 38 8 6 2 8 0 3 4 8 n = Columns 1 through 30 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 Columns 31 through 39 8 6 2 8 0 3 4 8 2 n = Columns 1 through 30 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 Columns 31 through 40 8 6 2 8 0 3 4 8 2 5 n = Columns 1 through 30 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 Columns 31 through 41 8 6 2 8 0 3 4 8 2 5 3 n = Columns 1 through 30 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 Columns 31 through 42 8 6 2 8 0 3 4 8 2 5 3 4 n = Columns 1 through 30 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 Columns 31 through 43 8 6 2 8 0 3 4 8 2 5 3 4 2 n = Columns 1 through 30 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 Columns 31 through 44 8 6 2 8 0 3 4 8 2 5 3 4 2 1 n = Columns 1 through 30 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 Columns 31 through 45 8 6 2 8 0 3 4 8 2 5 3 4 2 1 1 n = Columns 1 through 30 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 Columns 31 through 46 8 6 2 8 0 3 4 8 2 5 3 4 2 1 1 7 n = Columns 1 through 30 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 Columns 31 through 47 8 6 2 8 0 3 4 8 2 5 3 4 2 1 1 7 0 n = Columns 1 through 30 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 Columns 31 through 48 8 6 2 8 0 3 4 8 2 5 3 4 2 1 1 7 0 6 n = Columns 1 through 30 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 Columns 31 through 49 8 6 2 8 0 3 4 8 2 5 3 4 2 1 1 7 0 6 7 pr = [] pr = 0 pr = 0 0 pr = 0 0 0 pr = 0 0 0 0 pr = 0 0 0 0 9072 pr = 0 0 0 0 9072 4032 pr = 0 0 0 0 9072 4032 2880 pr = 0 0 0 0 9072 4032 2880 6480 pr = 0 0 0 0 9072 4032 2880 6480 1440 pr = 0 0 0 0 9072 4032 2880 6480 1440 1080 pr = 0 0 0 0 9072 4032 2880 6480 1440 1080 0 pr = 0 0 0 0 9072 4032 2880 6480 1440 1080 0 0 pr = 0 0 0 0 9072 4032 2880 6480 1440 1080 0 0 0 pr = 0 0 0 0 9072 4032 2880 6480 ...

3   Pass
s = '141592653589793238462643383279502884197169399399999'; i_correct = 47; assert(isequal(running_product(s),i_correct))

n = [] l = 51 n = 1 n = 1 4 n = 1 4 1 n = 1 4 1 5 n = 1 4 1 5 9 n = 1 4 1 5 9 2 n = 1 4 1 5 9 2 6 n = 1 4 1 5 9 2 6 5 n = 1 4 1 5 9 2 6 5 3 n = 1 4 1 5 9 2 6 5 3 5 n = 1 4 1 5 9 2 6 5 3 5 8 n = 1 4 1 5 9 2 6 5 3 5 8 9 n = 1 4 1 5 9 2 6 5 3 5 8 9 7 n = 1 4 1 5 9 2 6 5 3 5 8 9 7 9 n = 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 n = 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 n = 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 n = 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 n = 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 n = 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 n = 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 n = 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 n = 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 n = 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 n = 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 n = 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 n = 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 n = 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 n = 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 n = 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Column 31 5 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Columns 31 through 32 5 0 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Columns 31 through 33 5 0 2 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Columns 31 through 34 5 0 2 8 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Columns 31 through 35 5 0 2 8 8 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Columns 31 through 36 5 0 2 8 8 4 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Columns 31 through 37 5 0 2 8 8 4 1 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Columns 31 through 38 5 0 2 8 8 4 1 9 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Columns 31 through 39 5 0 2 8 8 4 1 9 7 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Columns 31 through 40 5 0 2 8 8 4 1 9 7 1 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Columns 31 through 41 5 0 2 8 8 4 1 9 7 1 6 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Columns 31 through 42 5 0 2 8 8 4 1 9 7 1 6 9 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Columns 31 through 43 5 0 2 8 8 4 1 9 7 1 6 9 3 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Columns 31 through 44 5 0 2 8 8 4 1 9 7 1 6 9 3 9 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Columns 31 through 45 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Columns 31 through 46 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 3 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Columns 31 through 47 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 3 9 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Columns 31 through 48 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 3 9 9 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Columns 31 through 49 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 3 9 9 9 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Columns 31 through 50 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 3 9 9 9 9 n = Columns 1 through 30 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 Columns 31 through 51 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 3 9 9 9 9 9 pr = [] pr = 180 pr = 180 360 pr = 180 360 540 pr = 180 360 540 2700 pr = 180 360 540 2700 1620 pr = 180 360 540 2700 1620 900 pr = 180 360 540 2700 1620 900 3600 pr = 180 360 540 2700 1620 900 3600 5400 pr = 180 360 540 2700 16...

4   Pass
s = '7831652712019091456485669234603486104543266482133936072602'; i_correct = 21; assert(isequal(running_product(s),i_correct))

n = [] l = 58 n = 7 n = 7 8 n = 7 8 3 n = 7 8 3 1 n = 7 8 3 1 6 n = 7 8 3 1 6 5 n = 7 8 3 1 6 5 2 n = 7 8 3 1 6 5 2 7 n = 7 8 3 1 6 5 2 7 1 n = 7 8 3 1 6 5 2 7 1 2 n = 7 8 3 1 6 5 2 7 1 2 0 n = 7 8 3 1 6 5 2 7 1 2 0 1 n = 7 8 3 1 6 5 2 7 1 2 0 1 9 n = 7 8 3 1 6 5 2 7 1 2 0 1 9 0 n = 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 n = 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 n = 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 n = 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 n = 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 n = 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 n = 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 n = 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 n = 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 n = 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 n = 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 n = 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 n = 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 n = 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 n = 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 n = 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Column 31 3 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 32 3 4 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 33 3 4 8 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 34 3 4 8 6 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 35 3 4 8 6 1 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 36 3 4 8 6 1 0 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 37 3 4 8 6 1 0 4 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 38 3 4 8 6 1 0 4 5 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 39 3 4 8 6 1 0 4 5 4 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 40 3 4 8 6 1 0 4 5 4 3 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 41 3 4 8 6 1 0 4 5 4 3 2 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 42 3 4 8 6 1 0 4 5 4 3 2 6 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 43 3 4 8 6 1 0 4 5 4 3 2 6 6 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 44 3 4 8 6 1 0 4 5 4 3 2 6 6 4 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 45 3 4 8 6 1 0 4 5 4 3 2 6 6 4 8 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 46 3 4 8 6 1 0 4 5 4 3 2 6 6 4 8 2 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 47 3 4 8 6 1 0 4 5 4 3 2 6 6 4 8 2 1 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 48 3 4 8 6 1 0 4 5 4 3 2 6 6 4 8 2 1 3 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 49 3 4 8 6 1 0 4 5 4 3 2 6 6 4 8 2 1 3 3 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 50 3 4 8 6 1 0 4 5 4 3 2 6 6 4 8 2 1 3 3 9 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 51 3 4 8 6 1 0 4 5 4 3 2 6 6 4 8 2 1 3 3 9 3 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 Columns 31 through 52 3 4 8 6 1 0 4 5 4 3 2 6 6 4 8 2 1 3 3 9 3 6 n = Columns 1 through 30 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 ...

5   Pass
s = '70066063155881748815209209628292540917153643678925903600113305305488'; i_correct = 44; assert(isequal(running_product(s),i_correct))

n = [] l = 68 n = 7 n = 7 0 n = 7 0 0 n = 7 0 0 6 n = 7 0 0 6 6 n = 7 0 0 6 6 0 n = 7 0 0 6 6 0 6 n = 7 0 0 6 6 0 6 3 n = 7 0 0 6 6 0 6 3 1 n = 7 0 0 6 6 0 6 3 1 5 n = 7 0 0 6 6 0 6 3 1 5 5 n = 7 0 0 6 6 0 6 3 1 5 5 8 n = 7 0 0 6 6 0 6 3 1 5 5 8 8 n = 7 0 0 6 6 0 6 3 1 5 5 8 8 1 n = 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 n = 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 n = 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 n = 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 n = 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 n = 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 n = 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 n = 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 n = 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 n = 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 n = 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 n = 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 n = 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 n = 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 n = 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 n = 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Column 31 9 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 32 9 2 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 33 9 2 5 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 34 9 2 5 4 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 35 9 2 5 4 0 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 36 9 2 5 4 0 9 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 37 9 2 5 4 0 9 1 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 38 9 2 5 4 0 9 1 7 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 39 9 2 5 4 0 9 1 7 1 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 40 9 2 5 4 0 9 1 7 1 5 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 41 9 2 5 4 0 9 1 7 1 5 3 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 42 9 2 5 4 0 9 1 7 1 5 3 6 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 43 9 2 5 4 0 9 1 7 1 5 3 6 4 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 44 9 2 5 4 0 9 1 7 1 5 3 6 4 3 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 45 9 2 5 4 0 9 1 7 1 5 3 6 4 3 6 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 46 9 2 5 4 0 9 1 7 1 5 3 6 4 3 6 7 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 47 9 2 5 4 0 9 1 7 1 5 3 6 4 3 6 7 8 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 48 9 2 5 4 0 9 1 7 1 5 3 6 4 3 6 7 8 9 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 49 9 2 5 4 0 9 1 7 1 5 3 6 4 3 6 7 8 9 2 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 50 9 2 5 4 0 9 1 7 1 5 3 6 4 3 6 7 8 9 2 5 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 51 9 2 5 4 0 9 1 7 1 5 3 6 4 3 6 7 8 9 2 5 9 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 Columns 31 through 52 9 2 5 4 0 9 1 7 1 5 3 6 4 3 6 7 8 9 2 5 9 0 n = Columns 1 through 30 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 ...

6   Pass
s = '11111'; i_correct = 1; assert(isequal(running_product(s),i_correct))

n = [] l = 5 n = 1 n = 1 1 n = 1 1 1 n = 1 1 1 1 n = 1 1 1 1 1 pr = [] pr = 1 val = 1 idx = 1 i = 1