Re: Primality test function doesn't work on large numbers?

2017-01-12 Thread Timon Gehr via Digitalmars-d-learn
On 10.01.2017 04:02, Elronnd wrote: Thank you! Would you mind telling me what you changed aside from pow() and powm()? 1. This code: // make 2^a = integer-1 while ((integer-1)%(pow(bigint(2), a))!=0) a--; m = (integer-1) / pow(bigint(2), a); a starts out as integer-1, so this computes ma

Re: Primality test function doesn't work on large numbers?

2017-01-10 Thread Eugene Wissner via Digitalmars-d-learn
On Tuesday, 10 January 2017 at 03:02:40 UTC, Elronnd wrote: 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 sti

Re: Primality test function doesn't work on large numbers?

2017-01-09 Thread Elronnd via Digitalmars-d-learn
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 gener

Re: Primality test function doesn't work on large numbers?

2017-01-08 Thread Timon Gehr via Digitalmars-d-learn
On 08.01.2017 08:52, Elronnd wrote: I'm working on writing an RSA implementation, but I've run into a roadblock generating primes. With a more than 9 bits, my program either hangs for a long time (utilizing %100 CPU!) or returns a composite number. With 9 or fewer bits, I get primes, but I have

Re: Primality test function doesn't work on large numbers?

2017-01-08 Thread Eugene Wissner via Digitalmars-d-learn
On Sunday, 8 January 2017 at 07:52:33 UTC, Elronnd wrote: I'm working on writing an RSA implementation, but I've run into a roadblock generating primes. With a more than 9 bits, my program either hangs for a long time (utilizing %100 CPU!) or returns a composite number. With 9 or fewer bits,

Primality test function doesn't work on large numbers?

2017-01-07 Thread Elronnd via Digitalmars-d-learn
I'm working on writing an RSA implementation, but I've run into a roadblock generating primes. With a more than 9 bits, my program either hangs for a long time (utilizing %100 CPU!) or returns a composite number. With 9 or fewer bits, I get primes, but I have to run with a huge number of iter