Cody

# Problem 1742. Generate a Parasitic Number

Solution 719722

Submitted on 22 Aug 2015 by goc3
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))

p = 28 b = 87 p = 348 b = 487 p = 1948 b = 9487 p = 37948 b = 79487 p = 317948 b = 179487 p = 717948 b = 179487

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

p = 28 b = 84 p = 588 b = 884 p = 6188 b = 1884 p = 13188 b = 31884 p = 223188 b = 231884 p = 1623188 b = 6231884 p = 43623188 b = 36231884 p = 253623188 b = 536231884 p = 3753623188 b = 7536231884 p = 52753623188 b = 27536231884 p = 192753623188 b = 927536231884 p = 6492753623188 b = 4927536231884 p = 34492753623188 b = 44927536231884 p = 314492753623188 b = 144927536231884 p = 1014492753623188 b = 0144927536231884 p = 1014492753623188 b = 0144927536231884 p = 1014492753623188 b = 0144927536231884 p = 1014492753623188 b = 0144927536231884 p = 1014492753623188 b = 0144927536231884 p = 1014492753623188 b = 0144927536231884 ans = 0579710144927536231884

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

p = 12 b = 26 p = 52 b = 26 p = 52 b = 26 p = 52 b = 26 p = 52 b = 26 p = 52 b = 26 p = 52 b = 26 p = 52 b = 26 p = 52 b = 26 p = 52 b = 26 p = 52 b = 26 p = 52 b = 26 p = 52 b = 26 p = 52 b = 26 p = 52 b = 26 p = 52 b = 26 p = 52 b = 26 p = 52 b = 26 p = 52 b = 26 p = 52 b = 26 ans = 315789473684210526

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

p = 35 b = 57 p = 285 b = 857 p = 4285 b = 2857 p = 14285 b = 42857 p = 214285 b = 142857 p = 714285 b = 142857

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

p = 3 b = 3

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

y_correct = 1016949152542372881355932203389830508474576271186440677966 p = 36 b = 66 p = 396 b = 966 p = 5796 b = 7966 p = 47796 b = 77966 p = 467796 b = 677966 p = 4067796 b = 0677966 p = 4067796 b = 0677966 p = 4067796 b = 0677966 p = 4067796 b = 0677966 p = 4067796 b = 0677966 p = 4067796 b = 0677966 p = 4067796 b = 0677966 p = 4067796 b = 0677966 p = 4067796 b = 0677966 p = 4067796 b = 0677966 p = 4067796 b = 0677966 p = 4067796 b = 0677966 p = 4067796 b = 0677966 p = 4067796 b = 0677966 p = 4067796 b = 0677966 ans = 1016949152542372881355932203389830508474576271186440677966

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

y_correct = 06741573033707865168539325842696629213483146 p = 54 b = 46 p = 414 b = 146 p = 1314 b = 3146 p = 28314 b = 83146 p = 748314 b = 483146 p = 4348314 b = 3483146 p = 31348314 b = 13483146 p = 121348314 b = 213483146 p = 1921348314 b = 9213483146 p = 82921348314 b = 29213483146 p = 262921348314 b = 629213483146 p = 5662921348314 b = 6629213483146 p = 59662921348314 b = 96629213483146 p = 869662921348314 b = 696629213483146 p = 6269662921348314 b = 2696629213483146 p = 24269662921348314 b = 42696629213483146 p = 384269662921348314 b = 842696629213483146 p = 7584269662921348314 b = 5842696629213483146 p = 52584269662921348314 b = 25842696629213483146 p = 232584269662921348314 b = 325842696629213483146 ans = 06741573033707865168539325842696629213483146