I'm trying to perform the following calculation:
$$ a\pmod m $$
where both $a$ and $m$ are numbers larger than $32$ bits. However, I'm only able to perform calculations on $32$ bit numbers.
So I was wondering if there is a way to compute arbitrary precision modulo.
The most simple way is using Python 2.5+ or Python 3.0+.
Just perform standard math operations and any number which exceeds the boundaries of 32-bit math will be automatically and transparently converted to a
bignum.Moreover, Python is an interpreted language so you may use it as a calculator - just write an expression an press Enter to see the result.
Modulo in Python is represented by the operator
%.Example:
gives the result