I have two numbers:

A= a1*a2*a3.....an

B= b1*b2*b3.....bm

I need to calculate (A/B) mod 10^9+7 because a and b may be very large numbers

How should I do that ( it is proved that B is a divisor of A).

A= a1*a2*a3.....an

B= b1*b2*b3.....bm

I need to calculate (A/B) mod 10^9+7 because a and b may be very large numbers

How should I do that ( it is proved that B is a divisor of A).

a and b may be very large numbers |

Define very large. More than 18 decimal digits?

If 18 decimal digits or less you can use int64, otherwise you will have to use a bigint library. Here's one: http://gmplib.org/

There are others.

Topic archived. No new replies allowed.