# How to calculate modulo of large integer (number having 25000 digits)

I'm looking for solution to a problem to calculate modulo of very large number that can contain 25000 digits or less (n) with 10 digit number (m). ( n % m ) ?

Pointer to appropriate theory resource is also welcome.

Thanks

-
You mean on a computer? You'll probably have to use a bignum library of some kind – in which case this is just a programming question, rather than mathematics. –  Zhen Lin Nov 4 '12 at 11:49
Do you have the numbers in some special form or are you asking about the general case? –  Karolis Juodelė Nov 4 '12 at 11:49
@KarolisJuodelė General Case. –  Jaini Nov 4 '12 at 11:51
Why is the case of large number different from the case of small numbers? As Zhen asked, is this a programming problem? –  Karolis Juodelė Nov 4 '12 at 11:55
If I had to guess, the big number is obtained by exponentiating something, in which case the most efficient course of action is to keep reducing modulo $m$ while computing $n$ in the first place! –  Zhen Lin Nov 4 '12 at 12:50

As small as your modulus is, I don't think you can do significantly better than ordinary long division (typically done in base $2^{64}$) to compute the remainder.