![]() Otherwise, let p now equal this number (which is the next prime), and repeat from step 3Īt the end when the algorithm terminates, all the numbers in the list that are not marked are the prime numbers. Find the first number greater than p in the list that is not marked. Well first write a function to check whether a number is prime or not and then we loop through the first 100 numbers i.e.note that some of them may have already been marked Starting from p, count up in increments of p and mark each of these numbers greater than p itself in the list. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |