Question: Recall that an integer is called prime if its only divisors are 1 and the number itself. The first few primes are: 2, 3, 5,

Recall that an integer is called prime if its only divisors are 1 and the number itself. The first few primes are: 2, 3, 5, 7, and 11 (1 is not considered to be prime).
Write a program that prints (to a file) the first n primes, where n is input by the user. Your program must utilize the function is prime() shown in the solutions6.txt file.
For marking purposes run your program with n = 9. Your program output should look like:
count prime ------- -------
12 23 35 47 5 11 6 13 7 17 8 19 9 23
Note that the tricky part of testing whether an integer is prime has been coded for you in the function is prime. See solutions6.txt for the code.

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!