Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started