question about result from mpz_ModPow
rich beck
rich.beck at sbcglobal.net
Sun Aug 2 15:55:55 CEST 2026
Greetigs from Rolla-Saint James, MO:
I am testing GNU/GMP using VB.net in visual studio 2026 and have a C++
CLI/V143 interface between VB.net and GNU/GMP to pass to and receive
results from GMP.
the runtimes of the mpz_ModPow function are MUCH faster than what I am
seeing with native BigInteger.ModPow function calls made directly in
VB.net, thank you!
When I run the following ModPow problem:
result = 3 ^ (prime-1)/2 MOD prime, where prime=329 x 2^4193199 +1,
and 3 is a primitive root of the prime.
The result should be the totient, (or (prime-1)) but i am not getting
that result in GMP.
All other tests i run with primes <= 2M-bits in length work fine and
return expected results of (prime-1) using the GMPBridge.h code as the
bridge between GNU and VB.net.
Is there an implicit or undocumented string length in arguments that
I am exceeding when I test with this HUGE prime number?
I would like to test one additional candidate NTT_Prime:
31 x 2^8348000 +1, also using 3 as the primitive root,
and use GNU/GMP to do this. BigInteger.ModPow can not process this, and
am hoping that GNU/GMP can handle this size prime, but there appears
to be an argument length limit of roughly 2M-bits.
btw: this 4M-bit prime test runs about 32hrs on my HP Z2-G9 tower using
the C++ CLI bridge; when i run the problem using native
BigInteger.ModPow(3,(prime-1)/2, prime) using this same HUGE prime, i
get the expected result of (prime-1), but it runs for over 14days,
8+hrs!!!
All arguments in both cases described above are BigInteger data types.
very respectfully,
rich beck
15820 CR 2350, Saint James, MO. 65559
rich.beck at sbcglobal.net
314-737-2272
More information about the gmp-bugs
mailing list