Saturday, 15 June 2013

java - Modular Arithmetic in programming -



java - Modular Arithmetic in programming -

can explain me how modular arithmetic works in programming? know used operate on big values.

for example, calculate binomial coefficient of b(1000000, 2) using int data-type. assume couldn't multiply using int data-type, since involves calculating factorials of big values 1000000! has millions of digits, don't fit in 32-bit or 64-bit integer.

i know modular arithmetic used these type of problems, don't understand how works.

the modulo operation simple operation calculates remainder of division. instance 5 % 3 = 2 dividing 5 3 give a remainder of .

a mutual usecase checking whether number or odd. number % 2 == 0 means number even.

for more info please check wikipedia.

java performance scalability binomial-coefficients

No comments:

Post a Comment