Cody

# Problem 49. Sums with Excluded Digits

Solution 2004625

Submitted on 6 Nov 2019 by Weiyang Zhang
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 = 20; m = 5; total = 190; assert(isequal(no_digit_sum(n,m),total))

ind_i = logical 0 total = 1 ind_i = logical 0 total = 3 ind_i = logical 0 total = 6 ind_i = logical 0 total = 10 ind_i = logical 1 ind_i = logical 0 total = 16 ind_i = logical 0 total = 23 ind_i = logical 0 total = 31 ind_i = logical 0 total = 40 ind_i = 1×2 logical array 0 0 total = 50 ind_i = 1×2 logical array 0 0 total = 61 ind_i = 1×2 logical array 0 0 total = 73 ind_i = 1×2 logical array 0 0 total = 86 ind_i = 1×2 logical array 0 0 total = 100 ind_i = 1×2 logical array 0 1 ind_i = 1×2 logical array 0 0 total = 116 ind_i = 1×2 logical array 0 0 total = 133 ind_i = 1×2 logical array 0 0 total = 151 ind_i = 1×2 logical array 0 0 total = 170 ind_i = 1×2 logical array 0 0 total = 190

2   Pass
n = 10; m = 5; total = 50; assert(isequal(no_digit_sum(n,m),total))

ind_i = logical 0 total = 1 ind_i = logical 0 total = 3 ind_i = logical 0 total = 6 ind_i = logical 0 total = 10 ind_i = logical 1 ind_i = logical 0 total = 16 ind_i = logical 0 total = 23 ind_i = logical 0 total = 31 ind_i = logical 0 total = 40 ind_i = 1×2 logical array 0 0 total = 50

3   Pass
n = 33; m = 3; total = 396; assert(isequal(no_digit_sum(n,m),total))

ind_i = logical 0 total = 1 ind_i = logical 0 total = 3 ind_i = logical 1 ind_i = logical 0 total = 7 ind_i = logical 0 total = 12 ind_i = logical 0 total = 18 ind_i = logical 0 total = 25 ind_i = logical 0 total = 33 ind_i = logical 0 total = 42 ind_i = 1×2 logical array 0 0 total = 52 ind_i = 1×2 logical array 0 0 total = 63 ind_i = 1×2 logical array 0 0 total = 75 ind_i = 1×2 logical array 0 1 ind_i = 1×2 logical array 0 0 total = 89 ind_i = 1×2 logical array 0 0 total = 104 ind_i = 1×2 logical array 0 0 total = 120 ind_i = 1×2 logical array 0 0 total = 137 ind_i = 1×2 logical array 0 0 total = 155 ind_i = 1×2 logical array 0 0 total = 174 ind_i = 1×2 logical array 0 0 total = 194 ind_i = 1×2 logical array 0 0 total = 215 ind_i = 1×2 logical array 0 0 total = 237 ind_i = 1×2 logical array 0 1 ind_i = 1×2 logical array 0 0 total = 261 ind_i = 1×2 logical array 0 0 total = 286 ind_i = 1×2 logical array 0 0 total = 312 ind_i = 1×2 logical array 0 0 total = 339 ind_i = 1×2 logical array 0 0 total = 367 ind_i = 1×2 logical array 0 0 total = 396 ind_i = 1×2 logical array 1 0 ind_i = 1×2 logical array 1 0 ind_i = 1×2 logical array 1 0 ind_i = 1×2 logical array 1 1