Problems when 'mod' quite big number (like factorial).

3 visualizzazioni (ultimi 30 giorni)
mod(factorial(22),10000)
mod(factorial(23),10000)
The answers should both be 0. However, the answers are 0 and 2864 seperately.
How to solve this problem?
Thank you very much!

Risposta accettata

David Hill
David Hill il 5 Mag 2022
Modificato: David Hill il 5 Mag 2022
x=sym('23');
mod(factorial(x),10000)
x=sym('24');
mod(factorial(x),10000)
  1 Commento
Songbai Jin
Songbai Jin il 6 Mag 2022
Thanks for your answer. I'd really appreciate it if you could help with the other two similar questions I've asked.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Performance and Memory in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by