Prime number is an integer greater

Assignment Help Basic Computer Science
Reference no: EM131788439

A prime number is an integer greater than 1 whose only positive divisors are 1 and the integer itself. The Greek mathematician Eratosthenes developed an algorithm, known as the Sieve of Eratosthenes, for finding all prime numbers less than or equal to a given number n-that is, all primes in the range 2 through n. Consider the list of numbers from 2 through n. Two is the first prime number, but the multiples of 2 (4,6,8, ...) are not, and so they are crossed out in the list. The first number after 2 that was not crossed out is 3, the next prime. We then cross out from the list all higher multiples of 3 (6,9,12, ...). The next number not crossed out is 5, the next prime, and so we cross out all higher multiples of 5 (10, 15,20, ...). We repeat this procedure until we reach the first number in the list that has not been crossed out and whose square is greater than n. All the numbers that remain in the list are the primes from 2 through n. Write a program that uses this sieve method and an array to find all the prime numbers from 2 through n. Execute the program for n =550 and for n =5500.

Reference no: EM131788439

Questions Cloud

Discuss the some changes may be in order : In fact, the FASB at one point discussed some changes may be in order. Historically, earnings have been the main measurement of profitability of a firm.
Distribution of closed mailboxes : When he finished, he was surprised at the distribution of closed mailboxes. Write a program to determine which mailboxes these were.
Prepare a detailing the components of pension expense : Prepare a schedule detailing the components of pension expense to bereported in 2003
What is the predicted final exam grade : Assume that in a political science class, the teacher gives a midterm exam and a final exam Assume that the association between midtem & final scores is linear.
Prime number is an integer greater : A prime number is an integer greater than 1 whose only positive divisors are 1 and the integer itself. The Greek mathematician Eratosthenes developed
Carrying from one element to the next when necessary : Then add two integers (lists), element by element, carrying from one element to the next when necessary.
What is total amount to be capitalized as development costs : Satellite Inc. incurred the following costs during the year ended December 31, 20X5: What is the total amount to be capitalized as development costs in 20X5?
Compute the predetermined overhead rate and break it down : Compute the predetermined overhead rate and break it down into variable and fixed cost elements.
Demographic study of the metropolitan area : A demographic study of the metropolitan area around Dog patch divided it into three regions-urban, suburban, and exurban-and published the following table

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Common task of a network administrator

A common task of a network administrator is to segment the network to provide for efficiency and throughput in the processing of data traffic.

  Both lagrange interpolation and newton''s interpolation

Use both Lagrange interpolation and Newton's interpolation formulae to find the polynomials for the

  Determine the minimum-cost production schedule

Formulate a mixed-integer program to determine the minimum-cost production schedule.

  Describe a specific web or mobile application''s purpose

Describe a specific web or mobile application's purpose. How is it used. What changes has it brought about to its users? What are some likely future uses and enhancements. Remember to keep a business focus.

  How does the use of the internet, intranets, and extranets

How does the use of the Internet, intranets, and extranets by companies today support their business processes and activities

  Create a method to make each object in the first list

Create a method to make each object in the first list say hello to each object in the second list, and vice versa.

  What should be said in reply to the ethical subjectivist

Using an example, such as moral reasoning in designing aluminum cans (Petroski) or in designing a portable seat for infants (Whitbeck), discuss how moral reasons can be objective (justified) even though they sometimes allow room for different appl..

  Determine the numerical value of acharcontaining

Write a segment of C++ code that will determine the numerical value of acharcontaining a digit in the range '0' ... '9' to an integer with the appropriate value. That is, ifchhas the value '3', the value3will be assigned to anintvariable. You may ..

  The motherboard is a volatile or non-volatile storage

The motherboard is a volatile or non-volatile storage unit and what does in control?

  Problem regarding the exceptions and recursion

Assume that if f calls g and g raises an exception that f does not handle, then the activation record of f is popped off the stack without returning control to the function f.

  Today business environment

It is common knowledge that in today's business environment, organizations must continually strive to achieve a competitive advantage. Likewise, they are reliant on large amounts of data to make their business decisions.

  Create a linked list of names and phone numbers

Why is creating a linked list usually done by one program, and the options to add, modify, or delete a structure in the list provided by a different program?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd