![]() ![]() Marking a number as 'not prime' is by zero'ing it out in our array. Not be included in the set of prime numbers. Why are both of the first two numbers 0? Well, 0 and 1 are known to Mean not prime and the number itself to mean prime. Although the typical sieve usesĪ boolean 0 or 1 to represent if a number is primed, we will use 0 to How do we goĪbout doing this? The method you will be using is to initialize anĪrray of integers to non-zero values. Not prime, nor will they play a part in our algorithm). Start with a list of numbers, incorrectly assuming at first thatĮvery number is prime (except for 0 and 1 of course, since those are THE FOLLOWING EXPLAINING THE 'Sieve of Eratosthenes' ALGORITHM THE PROGRAM SHOULD GIVE ME PRIME NUMBERS BETWEEN 'Sieve of Eratosthenes' ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |