subject

The Sieve of Eratosthenes (This assignment is worth 100 points) A prime integer is any integer greater than 1 that is evenly divisible only by itself and 1. The Sieve of Eratosthenes is a method of finding prime numbers. It operates as follows: Create a list with all elements initialized to 1 (true). List elements with prime indexes will remain 1. All other elements will eventually be set to zero. Starting with list element 2, every time a list element is found whose value is 1, loop through the remainder of the list and set to zero every element whose index is a multiple of the index for the element with value 1. For list index 2, all elements beyond 2 in the list that are multiples of 2 will be set to zero (indexes 4, 6, 8, 10, etc.); for list index 3, all elements beyond 3 in the list that are multiples of 3 will be set to zero (indexes 6, 9, 12, 15, etc.); and so on. When this process is complete, the list elements that are still set to 1 indicate that the index is a prime number. These indexes can then be printed. Write a program that uses a list of 1000 elements to determine and print the prime numbers between 2 and 999. Ignore element 0 of the list. The prime numbers must be printed out 10 numbers per line.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:30
Auniversity wants to install a client-server network. which feature do you think is important for them as they set up the network? sending email blocking multiple people to use the same file low security low set up cost limited access to files
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
For a typical middle-income family, what is the estimated cost of raising a child to the age of 18? $145,500 $245,340 $304,340 $455,500
Answers: 2
question
Computers and Technology, 23.06.2019 17:00
The more powerful, 60 volt cables and the main power shut off on an hev are both colored orange
Answers: 1
question
Computers and Technology, 23.06.2019 22:20
What is a programming method that provides for interactive modules to a website?
Answers: 1
You know the right answer?
The Sieve of Eratosthenes (This assignment is worth 100 points) A prime integer is any integer great...
Questions