Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part a. **22.8 (All prime numbers up to 10,000,000,000) Write a program that fnds all prime numbers upt o 10,000,000,000. Ther are approximately 455,052,511 such

Part a. **22.8 (All prime numbers up to 10,000,000,000) Write a program that fnds all prime numbers upt o 10,000,000,000. Ther are approximately 455,052,511 such prime numbers. Your program should meet the following requirements. * Your program should store the pirme numbers in a binary data file, named PrimeNumbers.dat. When a prime number is found, the number is appended to the file

* To find whether a new number is prime, your program should load the prime numbers from file to an array of the long type of size 10,000. If no number in the array is a divisor for the new number, continue to read the next 10000 prime numbers from the data file, until a divisor is found or all numbers in the file are read. If no divisior is found, the new number is prime.

--- Part b. Implement a method that open file PrimeNumbers.dat and perform the following

(NUmber of prime numbers) Programming Exercise 22.8 stores the prime numbers in afile named PrimeNumbers.dat. Write a program that finds the number of prime numbers that are less than or equal to 10, 100, 1,000, 10,000, 100,000, 1,000,000, 10,000,000, 100,000,000, 1,000,000,000, and 10,000,000,000. Your program should read the data from PrimeNumbers.dat

(sidenote) If possible, can this be shown through a program like eclipse or something similiar, I'm fairly new to this and I'm afraid I might mess things up so I'm seeking for expertise. Thank you for taking your time to read this :)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Sham Navathe

4th Edition

0321122267, 978-0321122261

More Books

Students also viewed these Databases questions

Question

=+4. Which instrument would you prefer? Why?

Answered: 1 week ago

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago