Cody

# Problem 1742. Generate a Parasitic Number

Solution 2075497

Submitted on 31 Dec 2019 by Asif Newaz
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))

k2 = '87' r = '82' k2 = '487' r = '483' k2 = '9487' r = '9481' k2 = '79487' r = '79483' k2 = '179487' r = '179483' k2 = '179487' r = '179487'

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))

k2 = '57' r = '53' k2 = '857' r = '852' k2 = '2857' r = '2854' k2 = '42857' r = '42851' k2 = '142857' r = '142852' k2 = '142857' r = '142857'

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

k2 = '3' r = '3'

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'