Question: 1 Find the Numbers (10 marks) To find all the numbers that are less than or equal to a given integer n by the defined

 1 Find the Numbers (10 marks) To find all the numbers

1 Find the Numbers (10 marks) To find all the numbers that are less than or equal to a given integer n by the defined method: 1 Create a list of consecutive integers from 2 through n: (2,3, 4, ..., n). 2 Initially, let p equal 2, the smallest number we want to find. 3 Enumerate the multiples of p by counting in increments of p from 2p to n, and mark them in the list (these will be 2p, 3p, 4p, ...; And the p itself should not be marked). 4 Find the smallest number in the list greater than p that is not marked. If there was no such number, then go to step 5. Otherwise, p is assigned to this new number which is the next number we want to find, and repeat from step 3. 5 The numbers remaining not marked in the list are all the numbers we want to find, and we print them. Please design program to complete the task and answer what's the property of the numbers. Input: n, an integer less than 100000000. Output: numbers we want to find. Example: Input: 4 Output: 23

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 Databases Questions!