Cody

Problem 49788. Carmichael Number

Solution 4597538

Submitted on 14 Jan 2021 at 15:35 by Kevin D
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 = 1; y_correct = false; assert(isequal(isCarmichael(x),y_correct))

y = logical 0

2   Pass
x = 10; y_correct = false; assert(isequal(isCarmichael(x),y_correct))

y = logical 0

3   Pass
x = 13; y_correct = false; assert(isequal(isCarmichael(x),y_correct))

y = logical 0

4   Pass
x = 561; y_correct = true; assert(isequal(isCarmichael(x),y_correct))

y = logical 0 y = logical 1

5   Pass
x = 10; y_correct = false; assert(isequal(isCarmichael(x),y_correct))

y = logical 0

6   Pass
x = 560; y_correct = false; assert(isequal(isCarmichael(x),y_correct))

y = logical 0

7   Pass
x = 561; y_correct = true; assert(isequal(isCarmichael(x),y_correct))

y = logical 0 y = logical 1

8   Pass
x = 1105; y_correct = true; assert(isequal(isCarmichael(x),y_correct))

y = logical 0 y = logical 1

9   Pass
x = 1729; % This is also Ramanujan number :D y_correct = true; assert(isequal(isCarmichael(x),y_correct))

y = logical 0 y = logical 1

10   Pass
x = 8911; y_correct = true; assert(isequal(isCarmichael(x),y_correct))

y = logical 0 y = logical 1

11   Pass
x = 9871; y_correct = false; assert(isequal(isCarmichael(x),y_correct))

y = logical 0

Suggested Problems

More from this Author1

Community Treasure Hunt

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

Start Hunting!