Cody

Problem 1925. Smith numbers

Solution 761475

Submitted on 15 Oct 2015 by Zikobrelli
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 = Columns 1 through 8 4 22 27 58 85 94 121 166 Columns 9 through 16 202 265 274 319 346 355 378 382 Columns 17 through 24 391 438 454 483 517 526 535 562 Columns 25 through 32 576 588 627 634 636 645 648 654 Columns 33 through 40 663 666 690 706 728 729 762 778 Columns 41 through 48 825 852 861 895 913 915 922 958 Columns 49 through 52 985 1086 1111 1165 tf = 1

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

A = Columns 1 through 8 4 22 27 58 85 94 121 166 Columns 9 through 16 202 265 274 319 346 355 378 382 Columns 17 through 24 391 438 454 483 517 526 535 562 Columns 25 through 32 576 588 627 634 636 645 648 654 Columns 33 through 40 663 666 690 706 728 729 762 778 Columns 41 through 48 825 852 861 895 913 915 922 958 Columns 49 through 52 985 1086 1111 1165 tf = 1

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

A = Columns 1 through 8 4 22 27 58 85 94 121 166 Columns 9 through 16 202 265 274 319 346 355 378 382 Columns 17 through 24 391 438 454 483 517 526 535 562 Columns 25 through 32 576 588 627 634 636 645 648 654 Columns 33 through 40 663 666 690 706 728 729 762 778 Columns 41 through 48 825 852 861 895 913 915 922 958 Columns 49 through 52 985 1086 1111 1165 tf = 1

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

A = Columns 1 through 8 4 22 27 58 85 94 121 166 Columns 9 through 16 202 265 274 319 346 355 378 382 Columns 17 through 24 391 438 454 483 517 526 535 562 Columns 25 through 32 576 588 627 634 636 645 648 654 Columns 33 through 40 663 666 690 706 728 729 762 778 Columns 41 through 48 825 852 861 895 913 915 922 958 Columns 49 through 52 985 1086 1111 1165 tf = 1

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

A = Columns 1 through 8 4 22 27 58 85 94 121 166 Columns 9 through 16 202 265 274 319 346 355 378 382 Columns 17 through 24 391 438 454 483 517 526 535 562 Columns 25 through 32 576 588 627 634 636 645 648 654 Columns 33 through 40 663 666 690 706 728 729 762 778 Columns 41 through 48 825 852 861 895 913 915 922 958 Columns 49 through 52 985 1086 1111 1165 tf = 1

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

A = Columns 1 through 8 4 22 27 58 85 94 121 166 Columns 9 through 16 202 265 274 319 346 355 378 382 Columns 17 through 24 391 438 454 483 517 526 535 562 Columns 25 through 32 576 588 627 634 636 645 648 654 Columns 33 through 40 663 666 690 706 728 729 762 778 Columns 41 through 48 825 852 861 895 913 915 922 958 Columns 49 through 52 985 1086 1111 1165 tf = 0

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

A = Columns 1 through 8 4 22 27 58 85 94 121 166 Columns 9 through 16 202 265 274 319 346 355 378 382 Columns 17 through 24 391 438 454 483 517 526 535 562 Columns 25 through 32 576 588 627 634 636 645 648 654 Columns 33 through 40 663 666 690 706 728 729 762 778 Columns 41 through 48 825 852 861 895 913 915 922 958 Columns 49 through 52 985 1086 1111 1165 tf = 0

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

A = Columns 1 through 8 4 22 27 58 85 94 121 166 Columns 9 through 16 202 265 274 319 346 355 378 382 Columns 17 through 24 391 438 454 483 517 526 535 562 Columns 25 through 32 576 588 627 634 636 645 648 654 Columns 33 through 40 663 666 690 706 728 729 762 778 Columns 41 through 48 825 852 861 895 913 915 922 958 Columns 49 through 52 985 1086 1111 1165 tf = 0

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

A = Columns 1 through 8 4 22 27 58 85 94 121 166 Columns 9 through 16 202 265 274 319 346 355 378 382 Columns 17 through 24 391 438 454 483 517 526 535 562 Columns 25 through 32 576 588 627 634 636 645 648 654 Columns 33 through 40 663 666 690 706 728 729 762 778 Columns 41 through 48 825 852 861 895 913 915 922 958 Columns 49 through 52 985 1086 1111 1165 tf = 0

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

A = Columns 1 through 8 4 22 27 58 85 94 121 166 Columns 9 through 16 202 265 274 319 346 355 378 382 Columns 17 through 24 391 438 454 483 517 526 535 562 Columns 25 through 32 576 588 627 634 636 645 648 654 Columns 33 through 40 663 666 690 706 728 729 762 778 Columns 41 through 48 825 852 861 895 913 915 922 958 Columns 49 through 52 985 1086 1111 1165 tf = 0

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

A = Columns 1 through 8 4 22 27 58 85 94 121 166 Columns 9 through 16 202 265 274 319 346 355 378 382 Columns 17 through 24 391 438 454 483 517 526 535 562 Columns 25 through 32 576 588 627 634 636 645 648 654 Columns 33 through 40 663 666 690 706 728 729 762 778 Columns 41 through 48 825 852 861 895 913 915 922 958 Columns 49 through 52 985 1086 1111 1165 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!