Question: use an algorithm to efficiently calculate all the prime numbers below N. How do you approach this? Quick and Dirty - How do you calculate

use an algorithm to efficiently calculate all the prime numbers below N. How do you approach this?

  1. Quick and Dirty - How do you calculate the prime numbers below 10? 50? 100? Use Excel to try to produce a solution. Count how many additions, subtractions, divisions and multiplications.
  2. Can we make it more efficient? After you did 2s, do you have to do 4s, 6s, 8s...? How do you track them? Are there any other rules of thumb observations you can see to improve your algorithm?
  3. What if you were told that division and multiplication are 100 times slower (more expensive) than addition and subtraction? Can that effect your program?

To Do:

  1. Create a Quick and Dirty pseudocode to solve this problem. *Version 1*
    1. Copy and paste version one and call it version 2. Modify version 2 in the next step.
  2. Revisit your code to see if it can be done more efficiently. *Version 2*
    1. Copy and paste version 2 and call it version 3. Modify version 3 in the next step.
  3. In a Breakout room with one or two classmates, compare solutions by talking about them. No showing your solution. *Version 3*
    1. Write the names of the other people in your breakout room.
    2. What were the observations you had?
    3. Were there any observations you can apply to your algorithm?
  4. Critical thinking: how do you measure your algorithms efficiency? We call this a metric.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithms Questions!