Cody

# Problem 1925. Smith numbers

Solution 2155794

Submitted on 10 Mar 2020
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
x = 4; tf_correct = true; assert(isequal(isSmith(x),tf_correct ))

Unrecognized function or variable 'digitsum'. Error in isSmith (line 8) tf = digitsum == factsum; Error in Test1 (line 3) assert(isequal(isSmith(x),tf_correct ))

2   Fail
x = 265; tf_correct = true; assert(isequal(isSmith(x),tf_correct ))

Unrecognized function or variable 'digitsum'. Error in isSmith (line 8) tf = digitsum == factsum; Error in Test2 (line 3) assert(isequal(isSmith(x),tf_correct ))

3   Fail
x = 588; tf_correct = true; assert(isequal(isSmith(x),tf_correct ))

Unrecognized function or variable 'digitsum'. Error in isSmith (line 8) tf = digitsum == factsum; Error in Test3 (line 3) assert(isequal(isSmith(x),tf_correct ))

4   Fail
x = 1086; tf_correct = true; assert(isequal(isSmith(x),tf_correct ))

Unrecognized function or variable 'digitsum'. Error in isSmith (line 8) tf = digitsum == factsum; Error in Test4 (line 3) assert(isequal(isSmith(x),tf_correct ))

5   Fail
x = 4937775; tf_correct = true; assert(isequal(isSmith(x),tf_correct ))

Unrecognized function or variable 'digitsum'. Error in isSmith (line 8) tf = digitsum == factsum; Error in Test5 (line 3) assert(isequal(isSmith(x),tf_correct ))

6   Fail
x = 5; tf_correct = false; assert(isequal(isSmith(x),tf_correct ))

Unrecognized function or variable 'digitsum'. Error in isSmith (line 8) tf = digitsum == factsum; Error in Test6 (line 3) assert(isequal(isSmith(x),tf_correct ))

7   Fail
x = 1000; tf_correct = false; assert(isequal(isSmith(x),tf_correct ))

Unrecognized function or variable 'digitsum'. Error in isSmith (line 8) tf = digitsum == factsum; Error in Test7 (line 3) assert(isequal(isSmith(x),tf_correct ))

8   Fail
x = 94.1; tf_correct = false; assert(isequal(isSmith(x),tf_correct ))

Error using factor (line 23) N must be a real nonnegative integer. Error in isSmith (line 5) facts = num2str(factor(x)); Error in Test8 (line 3) assert(isequal(isSmith(x),tf_correct ))

9   Fail
x = 202.689; tf_correct = false; assert(isequal(isSmith(x),tf_correct ))

Error using factor (line 23) N must be a real nonnegative integer. Error in isSmith (line 5) facts = num2str(factor(x)); Error in Test9 (line 3) assert(isequal(isSmith(x),tf_correct ))

10   Fail
x = pi; tf_correct = false; assert(isequal(isSmith(x),tf_correct ))

Error using factor (line 23) N must be a real nonnegative integer. Error in isSmith (line 5) facts = num2str(factor(x)); Error in Test10 (line 3) assert(isequal(isSmith(x),tf_correct ))

11   Fail
x = -4; tf_correct = false; assert(isequal(isSmith(x),tf_correct ))

Error using factor (line 23) N must be a real nonnegative integer. Error in isSmith (line 5) facts = num2str(factor(x)); Error in Test11 (line 3) assert(isequal(isSmith(x),tf_correct ))