Why MatLab gives me incorrect result for prime number?

4 views (last 30 days)
The function isprime() gives correct result for "small" numbers:
isprime(2^31-1) TRUE
BUT it gives incorrect result for larger numbers that are proved to be prime:
isprime(2^61-1) FALSE (but should be true)
WHY??
OK, I guess it is because I am trying to use a bigger number than Matlab can handle. But then, why Matlab does not show any error? and how can I check if a number this big is prime using MatLab?

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!