Question: There is a method for finding all the prime numbers up to n > 0 called the Sieve of Eratosthenes, which you can read about
There is a method for finding all the prime numbers up to called the Sieve of Eratosthenes, which you can read about on Wikipedia. The sieve can be modified it so that it counts the number factors of all the numbers from to by doing the following:
Make a list of the numbers from to and set the number of factors of each to
Starting at add one to the number of factors of every number up to
Starting at add one to the number of factors of every second number up to
Starting at add one to the number of factors of every third number up to
Starting at add one to the number of factors of every fourth number up to
Starting at add one to the number of factors of every number up to
Note, the last step only increments one number.
Write a program that reads in checks it is a sensible value and then prints out all the numbers from to along with how many factors it has. It should print a star beside any number that has the more factors than any smaller number eg and should each get a star because they are the smallest numbers to have and factors
Hint: You can assume but you should make it easy to increase this limit
PTO
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
