Cody

# Problem 1742. Generate a Parasitic Number

Solution 1643247

Submitted on 12 Oct 2018 by Athi
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))

4 X 7 = 28 4 X 87 = 348 4 X 487 = 1948 4 X 9487 = 37948 4 X 79487 = 317948 4 X 179487 = 717948

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

7 X 4 = 28 7 X 84 = 588 7 X 884 = 6188 7 X 1884 = 13188 7 X 31884 = 223188 7 X 231884 = 1623188 7 X 6231884 = 43623188 7 X 36231884 = 253623188 7 X 536231884 = 3753623188 7 X 7536231884 = 52753623188 7 X 27536231884 = 192753623188 7 X 927536231884 = 6492753623188 7 X 4927536231884 = 34492753623188 7 X 44927536231884 = 314492753623188 7 X 144927536231884 = 1014492753623188 7 X 0144927536231884 = 1014492753623188 7 X 10144927536231884 = 71014492753623188 7 X 710144927536231884 = 4971014492753623188 7 X 9710144927536231884 = 67971014492753623188 7 X 79710144927536231884 = 557971014492753623188 7 X 579710144927536231884 = 4057971014492753623188 7 X 0579710144927536231884 = 4057971014492753623188

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

2 X 6 = 12 2 X 26 = 52 2 X 526 = 1052 2 X 0526 = 1052 2 X 10526 = 21052 2 X 210526 = 421052 2 X 4210526 = 8421052 2 X 84210526 = 168421052 2 X 684210526 = 1368421052 2 X 3684210526 = 7368421052 2 X 73684210526 = 147368421052 2 X 473684210526 = 947368421052 2 X 9473684210526 = 18947368421052 2 X 89473684210526 = 178947368421052 2 X 789473684210526 = 1578947368421052 2 X 5789473684210526 = 11578947368421052 2 X 15789473684210526 = 31578947368421052 2 X 315789473684210526 = 631578947368421052

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

5 X 7 = 35 5 X 57 = 285 5 X 857 = 4285 5 X 2857 = 14285 5 X 42857 = 214285 5 X 142857 = 714285

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

1 X 3 = 3

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

y_correct = '1016949152542372881355932203389830508474576271186440677966' 6 X 6 = 36 6 X 66 = 396 6 X 966 = 5796 6 X 7966 = 47796 6 X 77966 = 467796 6 X 677966 = 4067796 6 X 0677966 = 4067796 6 X 40677966 = 244067796 6 X 440677966 = 2644067796 6 X 6440677966 = 38644067796 6 X 86440677966 = 518644067796 6 X 186440677966 = 1118644067796 6 X 1186440677966 = 7118644067796 6 X 71186440677966 = 427118644067796 6 X 271186440677966 = 1627118644067796 6 X 6271186440677966 = 37627118644067796 6 X 76271186440677966 = 457627118644067796 6 X 576271186440677966 = 3457627118644067796 6 X 4576271186440677966 = 27457627118644067796 6 X 74576271186440677966 = 447457627118644067796 6 X 474576271186440677966 = 2847457627118644067796 6 X 8474576271186440677966 = 50847457627118644067796 6 X 08474576271186440677966 = 50847457627118644067796 6 X 508474576271186440677966 = 3050847457627118644067796 6 X 0508474576271186440677966 = 3050847457627118644067796 6 X 30508474576271186440677966 = 183050847457627118644067796 6 X 830508474576271186440677966 = 4983050847457627118644067796 6 X 9830508474576271186440677966 = 58983050847457627118644067796 6 X 89830508474576271186440677966 = 538983050847457627118644067796 6 X 389830508474576271186440677966 = 2338983050847457627118644067796 6 X 3389830508474576271186440677966 = 20338983050847457627118644067796 6 X 03389830508474576271186440677966 = 20338983050847457627118644067796 6 X 203389830508474576271186440677966 = 1220338983050847457627118644067796 6 X 2203389830508474576271186440677966 = 13220338983050847457627118644067796 6 X 32203389830508474576271186440677966 = 193220338983050847457627118644067796 6 X 932203389830508474576271186440677966 = 5593220338983050847457627118644067796 6 X 5932203389830508474576271186440677966 = 35593220338983050847457627118644067796 6 X 55932203389830508474576271186440677966 = 335593220338983050847457627118644067796 6 X 355932203389830508474576271186440677966 = 2135593220338983050847457627118644067796 6 X 1355932203389830508474576271186440677966 = 8135593220338983050847457627118644067796 6 X 81355932203389830508474576271186440677966 = 488135593220338983050847457627118644067796 6 X 881355932203389830508474576271186440677966 = 5288135593220338983050847457627118644067796 6 X 2881355932203389830508474576271186440677966 = 17288135593220338983050847457627118644067796 6 X 72881355932203389830508474576271186440677966 = 437288135593220338983050847457627118644067796 6 X 372881355932203389830508474576271186440677966 = 2237288135593220338983050847457627118644067796 6 X 2372881355932203389830508474576271186440677966 = 14237288135593220338983050847457627118644067796 6 X 42372881355932203389830508474576271186440677966 = 254237288135593220338983050847457627118644067796 6 X 542372881355932203389830508474576271186440677966 = 3254237288135593220338983050847457627118644067796 6 X 2542372881355932203389830508474576271186440677966 = 15254237288135593220338983050847457627118644067796 6 X 52542372881355932203389830508474576271186440677966 = 315254237288135593220338983050847457627118644067796 6 X 152542372881355932203389830508474576271186440677966 = 915254237288135593220338983050847457627118644067796 6 X 9152542372881355932203389830508474576271186440677966 = 54915254237288135593220338983050847457627118644067796 6 X 49152542372881355932203389830508474576271186440677966 = 294915254237288135593220338983050847457627118644067796 6 X 949152542372881355932203389830508474576271186440677966 = 5694915254237288135593220338983050847457627118644067796 6 X 6949152542372881355932203389830508474576271186440677966 = 41694915254237288135593220338983050847457627118644067796 6 X 16949152542372881355932203389830508474576271186440677966 = 101694915254237288135593220338983050847457627118644067796 6 X 016949152542372881355932203389830508474576271186440677966 = 101694915254237288135593220338983050847457627118644067796 6 X 1016949152542372881355932203389830508474576271186440677966 = 6101694915254237288135593220338983050847457627118644067796

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

y_correct = '06741573033707865168539325842696629213483146' 9 X 6 = 54 9 X 46 = 414 9 X 146 = 1314 9 X 3146 = 28314 9 X 83146 = 748314 9 X 483146 = 4348314 9 X 3483146 = 31348314 9 X 13483146 = 121348314 9 X 213483146 = 1921348314 9 X 9213483146 = 82921348314 9 X 29213483146 = 262921348314 9 X 629213483146 = 5662921348314 9 X 6629213483146 = 59662921348314 9 X 96629213483146 = 869662921348314 9 X 696629213483146 = 6269662921348314 9 X 2696629213483146 = 24269662921348314 9 X 42696629213483146 = 384269662921348314 9 X 842696629213483146 = 7584269662921348314 9 X 5842696629213483146 = 52584269662921348314 9 X 25842696629213483146 = 232584269662921348314 9 X 325842696629213483146 = 2932584269662921348314 9 X 9325842696629213483146 = 83932584269662921348314 9 X 39325842696629213483146 = 353932584269662921348314 9 X 539325842696629213483146 = 4853932584269662921348314 9 X 8539325842696629213483146 = 76853932584269662921348314 9 X 68539325842696629213483146 = 616853932584269662921348314 9 X 168539325842696629213483146 = 1516853932584269662921348314 9 X 5168539325842696629213483146 = 46516853932584269662921348314 9 X 65168539325842696629213483146 = 586516853932584269662921348314 9 X 865168539325842696629213483146 = 7786516853932584269662921348314 9 X 7865168539325842696629213483146 = 70786516853932584269662921348314 9 X 07865168539325842696629213483146 = 70786516853932584269662921348314 9 X 707865168539325842696629213483146 = 6370786516853932584269662921348314 9 X 3707865168539325842696629213483146 = 33370786516853932584269662921348314 9 X 33707865168539325842696629213483146 = 303370786516853932584269662921348314 9 X 033707865168539325842696629213483146 = 303370786516853932584269662921348314 9 X 3033707865168539325842696629213483146 = 27303370786516853932584269662921348314 9 X 73033707865168539325842696629213483146 = 657303370786516853932584269662921348314 9 X 573033707865168539325842696629213483146 = 5157303370786516853932584269662921348314 9 X 1573033707865168539325842696629213483146 = 14157303370786516853932584269662921348314 9 X 41573033707865168539325842696629213483146 = 374157303370786516853932584269662921348314 9 X 741573033707865168539325842696629213483146 = 6674157303370786516853932584269662921348314 9 X 6741573033707865168539325842696629213483146 = 60674157303370786516853932584269662921348314 9 X 06741573033707865168539325842696629213483146 = 60674157303370786516853932584269662921348314