Cody

Problem 1925. Smith numbers

Solution 1205166

Submitted on 5 Jun 2017 by Augusto Mazzei
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 ))

tf = 0 tf = 2 -16 -16 2 tf = logical 1

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

tf = 0 tf = 5 -16 -16 5 3 tf = logical 1

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

tf = 0 tf = 2 -16 -16 2 -16 -16 3 -16 -16 7 -16 -16 7 tf = logical 1

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

tf = 0 tf = 2 -16 -16 -16 -16 3 -16 -16 1 8 1 tf = logical 1

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

tf = 0 tf = 3 -16 -16 -16 -16 -16 -16 5 -16 -16 -16 -16 -16 -16 5 -16 -16 6 5 8 3 7 tf = logical 1

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

tf = 0

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

tf = 0 tf = 2 -16 -16 2 -16 -16 2 -16 -16 5 -16 -16 5 -16 -16 5 tf = logical 0

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

tf = 0

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

tf = 0

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

tf = 0

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

tf = 0

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!