Given a, n, P
find the value of a^(nth Fibonacci number) % P
where a and P are *not* Co-prime
--
Sunny Aggrawal
B.Tech. V year,CSI
Indian Institute Of Technology,Roorkee
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
Hi everyone, I am stuck at places where I need to find lets say
Binomial_coefficient(1000,10) mod 1000 000 007 . What is the best way to do
this, assuming we donot have sufficient memory to use the naive approach :
(n,r) = (n-1,r) + (n-1,r-1) .
--
Dipit Grover
B.Tech in Computer Science and
Lets say n,m and p are three long long integers.
i want to calculate (n*m)%p.
If (n*m) overflows the limit of long long then the answer would be wrong.
Moreover if i do ((n%p)*(m%p))%p then also there is no certainty of getting
correct answer.
How should i do this in C++ ?
--
Aamir Khan | 3rd
(a/b)mod m = (amodm)*(Bmodm)
where B is the multiplicative inverse of b i.e
(b*B)modM = 1 or B = 1/b
Look into the wiki page of Multiplicative inverse for more.
Hope this helps
Cheers
Nikhil Jindal
On Wed, Jan 12, 2011 at 7:06 AM, mittal mohitm.1...@gmail.com wrote:
Somehelp with (a/b)modm
Somehelp with (a/b)modm expression.
http://en.wikipedia.org/wiki/Modular_arithmetic
i visited this link but found only for addition,subtraction and
multiplication.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send