Cody

Problem 44696. Sum of unique multiples of 3 and 5

Solution 1627112

Submitted on 13 Sep 2018
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   Fail
n = 15; sm_correct = 60; assert(isequal(sum3and5muls(n),sm_correct))

Error in solution Line: 6 Column: 27 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

2   Fail
n = 18; sm_correct = 78; assert(isequal(sum3and5muls(n),sm_correct))

Error in solution Line: 6 Column: 27 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

3   Fail
n = (2^2)-1; sm_correct = 3; assert(isequal(sum3and5muls(n),sm_correct))

Error in solution Line: 6 Column: 27 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

4   Fail
n = randi(25); sm_correct = sum(3:3:n)+sum(5:5:n)-sum(15:15:n); assert(isequal(sum3and5muls(n),sm_correct))

Error in solution Line: 6 Column: 27 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.