Cannot get mod to return correct value

조회 수: 1 (최근 30일)
Eugene Browder
Eugene Browder 2020년 7월 16일
댓글: Eugene Browder 2020년 7월 16일
I am trying to solve:
3^233 mod(353).
In Matlab, mod(3^233,353) = 92
But the correct answer is 248.
Is the number to large? Is this a configuration issue? Is there not enough digits being kept for the calculation? Do I need to do this another way?
Thank you.

채택된 답변

Fangjun Jiang
Fangjun Jiang 2020년 7월 16일
3^233 is an integer. Its value is roughly 1.5e111. So it needs 112 digits to record the integer value accurately. Double-precision data can't do that. I don't think MATLAB is the right tool for this.
  댓글 수: 1
Eugene Browder
Eugene Browder 2020년 7월 16일
Thank you for responding. I was trying to find the max values that could be used. Especially for the mod function.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

jonas
jonas 2020년 7월 16일
  댓글 수: 1
Eugene Browder
Eugene Browder 2020년 7월 16일
Thank you for responding. That looks promising. I will give that a try.

댓글을 달려면 로그인하십시오.

카테고리

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

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by