Cody

Solution 1952046

Submitted on 28 Sep 2019 by Augusto Mazzei
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
n=4;k=7;y_correct='179487'; assert(isequal(generate_parasitic(k,n),y_correct))

prods = 8 4 9 7 1 3 prods = 8 4 9 7 1 7 0 prods = 8 4 9 7 1 7 para = '179487'

2   Pass
n=7;k=4;y_correct='0579710144927536231884'; assert(isequal(generate_parasitic(k,n),y_correct))

prods = 8 8 1 6 prods = 8 8 1 3 1 prods = 8 8 1 3 2 2 prods = 8 8 1 3 2 6 1 prods = 8 8 1 3 2 6 3 4 prods = 8 8 1 3 2 6 3 5 2 prods = 8 8 1 3 2 6 3 5 7 3 prods = 8 8 1 3 2 6 3 5 7 2 5 prods = 8 8 1 3 2 6 3 5 7 2 9 1 prods = 8 8 1 3 2 6 3 5 7 2 9 4 6 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 3 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 1 3 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 1 0 1 0 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 1 0 1 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 1 0 1 0 0 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 1 0 1 0 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 1 0 1 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 1 0 1 7 0 0 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 1 0 1 7 0 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 1 0 1 7 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 1 0 1 7 9 4 0 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 1 0 1 7 9 4 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 1 0 1 7 9 7 6 0 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 1 0 1 7 9 7 6 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 1 0 1 7 9 7 5 5 0 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 1 0 1 7 9 7 5 5 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 1 0 1 7 9 7 5 0 4 0 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 1 0 1 7 9 7 5 0 4 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 1 0 1 7 9 7 5 0 4 0 0 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 1 0 1 7 9 7 5 0 4 0 prods = 8 8 1 3 2 6 3 5 7 2 9 4 4 1 0 1 7 9 7 5 0 4 para = '0579710144927536231884'

3   Pass
n=2;k=6;y_correct='315789473684210526'; assert(isequal(generate_parasitic(k,n),y_correct))

prods = 2 5 prods = 2 5 0 1 prods = 2 5 0 1 2 prods = 2 5 0 1 2 4 prods = 2 5 0 1 2 4 8 prods = 2 5 0 1 2 4 8 6 3 7 prods = 2 5 0 1 2 4 8 6 3 7 4 9 prods = 2 5 0 1 2 4 8 6 3 7 4 9 8 7 5 1 3 prods = 2 5 0 1 2 4 8 6 3 7 4 9 8 7 5 1 3 6 para = '315789473684210526'

4   Pass
n=5;k=7;y_correct='142857'; assert(isequal(generate_parasitic(k,n),y_correct))

prods = 5 8 2 4 1 7 para = '142857'

5   Pass
n=1;k=3;y_correct='3'; assert(isequal(generate_parasitic(k,n),y_correct))

para = '3'

6   Pass
n=6;k=6;y_correct='1016949152542372881355932203389830508474576271186440677966' assert(isequal(generate_parasitic(k,n),y_correct))

y_correct = '1016949152542372881355932203389830508474576271186440677966' prods = 6 9 7 7 6 0 4 prods = 6 9 7 7 6 0 4 0 prods = 6 9 7 7 6 0 4 prods = 6 9 7 7 6 0 4 4 2 prods = 6 9 7 7 6 0 4 4 6 2 prods = 6 9 7 7 6 0 4 4 6 8 3 prods = 6 9 7 7 6 0 4 4 6 8 1 5 prods = 6 9 7 7 6 0 4 4 6 8 1 1 1 prods = 6 9 7 7 6 0 4 4 6 8 1 1 7 0 prods = 6 9 7 7 6 0 4 4 6 8 1 1 7 prods = 6 9 7 7 6 0 4 4 6 8 1 1 7 2 4 prods = 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 1 prods = 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 3 prods = 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 prods = 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 3 prods = 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 2 prods = 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 4 prods = 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 2 prods = 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 prods = 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 prods = 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 prods = 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 prods = 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 0 prods = 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 prods = 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 1 prods = 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 4 prods = 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 5 prods = 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 5 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Column 31 2 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 33 0 2 0 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 32 0 2 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 34 0 2 0 0 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 33 0 2 0 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 32 0 2 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 35 0 2 2 1 0 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 34 0 2 2 1 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 36 0 2 2 3 1 0 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 35 0 2 2 3 1 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 37 0 2 2 3 9 1 0 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 36 0 2 2 3 9 1 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 38 0 2 2 3 9 5 5 0 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 37 0 2 2 3 9 5 5 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 39 0 2 2 3 9 5 5 3 0 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 38 0 2 2 3 9 5 5 3 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 40 0 2 2 3 9 5 5 3 3 0 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 39 0 2 2 3 9 5 5 3 3 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 41 0 2 2 3 9 5 5 3 1 2 0 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 40 0 2 2 3 9 5 5 3 1 2 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 42 0 2 2 3 9 5 5 3 1 8 0 0 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 41 0 2 2 3 9 5 5 3 1 8 0 prods = Columns 1 through 30 6 9 7 7 6 0 4 4 6 8 1 1 7 2 6 7 5 4 7 4 8 0 5 0 3 8 9 8 3 3 Columns 31 through 40 0 2 2 3 9 5 5 3 1 8 prods = Column...

7   Pass
n=9;k=6;y_correct='06741573033707865168539325842696629213483146' assert(isequal(generate_parasitic(k,n),y_correct))

y_correct = '06741573033707865168539325842696629213483146' prods = 4 1 4 prods = 4 1 3 1 prods = 4 1 3 8 2 prods = 4 1 3 8 4 7 prods = 4 1 3 8 4 3 4 prods = 4 1 3 8 4 3 1 3 prods = 4 1 3 8 4 3 1 2 1 prods = 4 1 3 8 4 3 1 2 9 1 prods = 4 1 3 8 4 3 1 2 9 2 8 prods = 4 1 3 8 4 3 1 2 9 2 6 2 prods = 4 1 3 8 4 3 1 2 9 2 6 6 5 prods = 4 1 3 8 4 3 1 2 9 2 6 6 9 5 prods = 4 1 3 8 4 3 1 2 9 2 6 6 9 6 8 prods = 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 6 prods = 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 2 prods = 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 3 prods = 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 7 prods = 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 5 prods = 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 2 prods = 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 2 prods = 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 8 prods = 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 3 prods = 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 4 prods = 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 7 prods = 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 6 prods = 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 1 prods = 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 4 prods = 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 5 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Column 31 7 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 32 0 7 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 33 0 7 0 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 32 0 7 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 34 0 7 3 6 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 35 0 7 3 3 3 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 37 0 7 3 3 0 3 0 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 36 0 7 3 3 0 3 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 38 0 7 3 3 0 3 0 0 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 37 0 7 3 3 0 3 0 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 36 0 7 3 3 0 3 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 39 0 7 3 3 0 3 7 2 0 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 38 0 7 3 3 0 3 7 2 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 40 0 7 3 3 0 3 7 5 6 0 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 39 0 7 3 3 0 3 7 5 6 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 41 0 7 3 3 0 3 7 5 1 5 0 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 40 0 7 3 3 0 3 7 5 1 5 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 42 0 7 3 3 0 3 7 5 1 4 1 0 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 41 0 7 3 3 0 3 7 5 1 4 1 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 43 0 7 3 3 0 3 7 5 1 4 7 3 0 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 42 0 7 3 3 0 3 7 5 1 4 7 3 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 44 0 7 3 3 0 3 7 5 1 4 7 6 6 0 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 3 9 3 5 8 6 1 5 6 8 7 Columns 31 through 43 0 7 3 3 0 3 7 5 1 4 7 6 6 prods = Columns 1 through 30 4 1 3 8 4 3 1 2 9 2 6 6 9 6 2 4 8 5 2 ...