Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Fast Composite Number Generator

Name: Anonymous 2013-06-27 0:53

Finally, I have found a solution that generates non-primes that can easily be understood by the layman.
int nonprime() {return (rand() + 2) * 5;}

Interestingly enough this also can be used to find prime numbers, as no number returned by this function is an element of the set of primes, greatly reducing the search space.

Name: Anonymous 2013-06-27 3:43

>>3
but then if rand() returns 0 then the answer is prime

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List