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 320543

Submitted on 18 Sep 2013 by Alfonso Nieto-Castanon

Correct

61Size
This is the leading solution.
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
 
%%
n=4;k=7;y_correct='179487';
assert(isequal(generate_parasitic(k,n),y_correct))

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

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

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

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

                    
6
Pass
 
%%
n=6;k=6;y_correct='1016949152542372881355932203389830508474576271186440677966'
assert(isequal(generate_parasitic(k,n),y_correct))
y_correct =
1016949152542372881355932203389830508474576271186440677966
7
Pass
 
%%
n=9;k=6;y_correct='06741573033707865168539325842696629213483146'
assert(isequal(generate_parasitic(k,n),y_correct))
y_correct =
06741573033707865168539325842696629213483146
8
Pass
 
%%
forbidden = 'freepass';
assert(isempty(regexp(evalc('type generate_parasitic'),forbidden)));