Primality test function doesn't work on large numbers?
Elronnd via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jan 9 19:02:40 PST 2017
Thank you! Would you mind telling me what you changed aside from
pow() and powm()? diff isn't giving me readable results, since
there was some other stuff I trimmed out of the original file.
Also, while this is a *lot* better, I still get some lag
generating 1024-bit primes and I can't generate larger primes in
a reasonable amount of time. Maybe my genbigint() function is to
blame? It isn't efficient:
bigint genbigint(int numbits) {
bigint tmp;
while (numbits --> 0) {
tmp <<= 1;
tmp += uniform(0, 2);
}
return tmp;
}
More information about the Digitalmars-d-learn
mailing list