Why MatLab gives me incorrect result for prime number?

조회 수: 4 (최근 30일)
Felipe Alcalde
Felipe Alcalde 2018년 1월 11일
편집: Felipe Alcalde 2018년 1월 11일
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?

답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by