Cody

# Problem 44523. Pattern Sum

Solution 3215963

Submitted on 15 Oct 2020 by Richard Thaxton
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
a = 4; b = 5; y_correct = 49380; assert(isequal(pattern_sum(a,b),y_correct))

tot = 4 temp = 4 temp = 44 tot = 4 44 temp = 444 tot = 4 44 444 temp = 4444 tot = 4 44 444 4444 temp = 44444 tot = 4 44 444 4444 44444 y = 49380

2   Pass
a = 7; b = 4; y_correct = 8638; assert(isequal(pattern_sum(a,b),y_correct))

tot = 7 temp = 7 temp = 77 tot = 7 77 temp = 777 tot = 7 77 777 temp = 7777 tot = 7 77 777 7777 y = 8638

3   Pass
a = 5; b = 3; y_correct = 615; assert(isequal(pattern_sum(a,b),y_correct))

tot = 5 temp = 5 temp = 55 tot = 5 55 temp = 555 tot = 5 55 555 y = 615

4   Pass
a = 1; b = 1; y_correct = 1; assert(isequal(pattern_sum(a,b),y_correct))

tot = 1 temp = 1 y = 1

5   Pass
a = 2; b = 2; y_correct = 24; assert(isequal(pattern_sum(a,b),y_correct))

tot = 2 temp = 2 temp = 22 tot = 2 22 y = 24

6   Pass
a = 9; b = 9; y_correct = 1111111101; assert(isequal(pattern_sum(a,b),y_correct))

tot = 9 temp = 9 temp = 99 tot = 9 99 temp = 999 tot = 9 99 999 temp = 9999 tot = 9 99 999 9999 temp = 99999 tot = 9 99 999 9999 99999 temp = 999999 tot = 9 99 999 9999 99999 999999 temp = 9999999 tot = 9 99 999 9999 99999 999999 9999999 temp = 99999999 tot = 9 99 999 9999 99999 999999 9999999 99999999 temp = 999999999 tot = 9 99 999 9999 99999 999999 9999999 99999999 999999999 y = 1.1111e+09

7   Pass
a = 0; b = 0; y_correct = 0; assert(isequal(pattern_sum(a,b),y_correct))

tot = 0 temp = 0 y = 0

8   Pass
a = 3; b = 8; y_correct = 37037034; assert(isequal(pattern_sum(a,b),y_correct))

tot = 3 temp = 3 temp = 33 tot = 3 33 temp = 333 tot = 3 33 333 temp = 3333 tot = 3 33 333 3333 temp = 33333 tot = 3 33 333 3333 33333 temp = 333333 tot = 3 33 333 3333 33333 333333 temp = 3333333 tot = 3 33 333 3333 33333 333333 3333333 temp = 33333333 tot = 3 33 333 3333 33333 333333 3333333 33333333 y = 37037034

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!