Maximum array size
Deewiant
deewiant.doesnotlike.spam at gmail.com
Wed Apr 26 10:34:57 PDT 2006
Ivan Kazmenko wrote:
> Secondly, for any number N, say, 1 <= N <= 100_000_000, I need to have a
> fast way to check whether it is prime.
Sounds to me like you want an associative array. I.e:
bool[int] primes;
primes[769] = true;
if (769 in primes) {
...
} else {
...
}
The only annoyance with this is that you might as well set primes[769] to false,
as you don't care about the value, only whether the key exists.
More information about the Digitalmars-d
mailing list