subject

A prime number 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 primitive type Boolean array with all elements initialized to true. Array elements with prime indices will remain true. All other array elements will eventually be set to false. Starting with array index 2, determine whether a given element is true. If so, loop through the remainder of the array and set to false every element whose index is a multiple of the index for the element with value true. Then continue the process with the next element with value true. For array index 2, all elements beyond element 2 in the array that have indices which are multiples of 2 (indices 4, 6, 8, 10, etc.) will be set to false; for array index 3, all elements beyond element 3 in the array that have indices which are multiples of 3 (indices 6, 9, 12, 15, etc.) will be set to false; and so on. When this process completes, the array elements that are still true indicate that the index is a prime number. These indices can be displayed. Write an application that uses an array of 1000 elements to determine and display the prime numbers between 2 and 999. Ignore array elements 0 and 1.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 13:20
Arectangular room is 4 meters longer than it is wide and its preimeter is 32 meters find the dimensions of the room
Answers: 3
question
Computers and Technology, 23.06.2019 18:00
File account.java (see previous exercise) contains a definition for a simple bank account class with methods to withdraw, deposit, get the balance and account number, and return a string representation. note that the constructor for this class creates a random account number. save this class to your directory and study it to see how it works. then write the following additional code: 1. suppose the bank wants to keep track of how many accounts exist. a. declare a private static integer variable numaccounts to hold this value. like all instance and static variables, it will be initialized (to 0, since itÒ€ℒs an int) automatically. b. add code to the constructor to increment this variable every time an account is created. c. add a static method getnumaccounts that returns the total number of accounts. think about why this method should be static - its information is not related to any particular account. d. file testaccounts1.java contains a simple program that creates the specified number of bank accounts then uses the getnumaccounts method to find how many accounts were created. save it to your directory, then use it to test your modified account class.
Answers: 3
question
Computers and Technology, 24.06.2019 01:30
Hazel has just finished adding pictures to her holiday newsletter. she decides to crop an image. what is cropping an image?
Answers: 1
question
Computers and Technology, 24.06.2019 03:00
Will do anything for brainlest so can you guys me out i will try my best to you out
Answers: 1
You know the right answer?
A prime number is any integer greater than 1 that is evenly divisible only by itself and 1. The Siev...
Questions
question
Geography, 03.11.2020 20:20
question
English, 03.11.2020 20:20
question
Mathematics, 03.11.2020 20:20
question
English, 03.11.2020 20:20
question
Social Studies, 03.11.2020 20:20
Questions on the website: 13722360