Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(A prime number, p, is called a Sophie Germain Prime if both p and 2p+1 are primes. The first few Sophie Germain Primes are 2,

(A prime number, p, is called a Sophie Germain Prime if both p and 2p+1 are primes. The first few Sophie Germain Primes are 2, 3, 5, 11, 23, 29, 41, 53, 83, 89, 113, 131, etc. It is not known whether there are an infinite number of such primes. The largest known Sophie Germain prime is 79911 decimal digits long)

Write a program to investigate the distribution of Sophie Germain Primes.Write a C program that reads an integer number, say r. It then computes and outputs a table with the number of Sophie Germain Primes less than 10, 10^2, 10^3, 10^r.

For example if r is 5 it should output:

3

10

37

190

1171

Test the program for different values for r.

To simplify the problem we could split it into smaller pieces by defining functions. One function that would be useful would be a function called isPrime. That function would take an integer argument, n, and return 1 if n is a prime number and 0 otherwise. Another useful function would be countValues which takes an integer argument, say and returns the number of Sophie Germain primes less than k.

The program must actually test numbers for primality and count the number of primes that are Sophe Germain primes. It must not just output the final results by obtaining them from other sources.

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

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions

Question

Question May a taxpayer roll over money from an IRA to an HSA?

Answered: 1 week ago

Question

Question What is the doughnut hole in HSA coverage?

Answered: 1 week ago