Cody

Problem 1925. Smith numbers

Solution 2036408

Submitted on 27 Nov 2019 by Asif Newaz
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
x = 4; tf_correct = true; assert(isequal(isSmith(x),tf_correct ))

a = 2 2 e = 4 e = 4 k = '4' l = 4 tf = 1

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

a = 5 53 e = 58 b = '53' c = 5 c = 5 3 d = 8 e = 13 k = '265' l = 13 tf = 1

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

a = 2 2 3 7 7 e = 21 e = 21 e = 21 e = 21 e = 21 k = '588' l = 21 tf = 1

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

a = 2 3 181 e = 186 e = 186 b = '181' c = 1 c = 1 8 c = 1 8 1 d = 10 e = 15 k = '1086' l = 15 tf = 1

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

a = 3 5 5 65837 e = 65850 e = 65850 e = 65850 b = '65837' c = 6 c = 6 5 c = 6 5 8 c = 6 5 8 3 c = 6 5 8 3 7 d = 29 e = 42 k = '4937775' l = 42 tf = 1

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

a = 5

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

a = 2 2 2 5 5 5 e = 21 e = 21 e = 21 e = 21 e = 21 e = 21 k = '1000' l = 1 tf = 0

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

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

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

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

Suggested Problems

More from this Author4

Community Treasure Hunt

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

Start Hunting!