Carmichael Number - MATLAB Cody - MATLAB Central

Problem 49788. Carmichael Number

Car michael number is a composite number n which satisfy following relation:
for all integers b which are coprime to n.
For example, the smallest Carmichael number is 561. It has prime factors 3, 11, and 17, thus it is a composite number (not prime and not 1). The relation is true for all integers b that are not divisible by 3, 11, or 17 (coprime to 561).
Build a function isCarmichael(x) that returns true if x is a Carmichael number and false otherwise.
Hint: Since can become a big number, using a modular exponentiation algorithm may help.

Solution Stats

29.09% Correct | 70.91% Incorrect
Last Solution submitted on Dec 13, 2023

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
4
8

Problem Recent Solvers10

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!