hello, im searching a function in c for modular exponentiation modpow using bigint.
i just find for c#, anyone can help?
hello, im searching a function in c for modular exponentiation modpow using bigint.
i just find for c#, anyone can help?
By "bigint" you mean multiple precision arithmetic integer types?
Try libgmp.
i need this function
but whit type BIGINT instead intCode:int power(int x, int exp, int n) { int res = 1; // Initialize result x = x % n; // Update x if it is more than or // equal to p while (exp > 0) { // If y is odd, multiply x with result if (exp & 1) res = (res*x) % n; // y must be even now exp = exp>>1; // y = y/2 x = (x*x) % n; } return res; }
There is no such built-in type named BIGINT. Refer to flp1969's post #2 for a library that can help.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)