I'm working with a number (count) roughly 320 bits in length, and a number (big) roughly 640 bits in length. I have both of the numbers in BigInteger form.
Now is it faster to check if 'count' is probably prime (maybe with a lower certainty parameter than 100), and then if it is, see if it is a factor of 'big', or would it just be faster to check if it is a factor of 'big' for each of them? Any comments would be appreciated, thanks!
Want a free iPod, digital camera, or $300 cash? Completely legit offer at <a href="http://www.geocities.com/pricklymustard/freestuff.html" target="_blank" rel="nofollow">http://www.geocities.com/pricklymustard/freestuff.html</a> . I am looking for referrals which is why I need YOU!
I'd bet on the latter, but to be sure I'd simply try both versions.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
With primitive ints there would be some fast checks - such as rejecting numbers with low bit = 0. I am guessing you could try rejecting all BigInteger where getlowestSetBit() != 0 - that is half your possible count values right there. Bill
Originally posted by William Brogden: With primitive ints there would be some fast checks - such as rejecting numbers with low bit = 0.
Isn't 2 a prime?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
One other thing... roughly 10% of all integers are primes, correct?
Want a free iPod, digital camera, or $300 cash? Completely legit offer at <a href="http://www.geocities.com/pricklymustard/freestuff.html" target="_blank" rel="nofollow">http://www.geocities.com/pricklymustard/freestuff.html</a> . I am looking for referrals which is why I need YOU!
No, as Natural numbers get larger the percentage of primes tends towards, but never reaches, 0.
That's interesting! I would have guessed that, too, but is it proven fact?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Proudly marching to the beat of a different kettle of fish... while reading this tiny ad
a bit of art, as a gift, that will fit in a stocking