Question
Introduction: Goldbachs conjecture is one of the oldest and best-known unsolved problems in number theory. It states: Every even integer greater than 2 can be
Introduction:
Goldbachs conjecture is one of the oldest and best-known unsolved problems in number theory. It states: Every even integer greater than 2 can be expressed as the sum of two prime numbers. (A prime number is a positive integer, greater than 1, that has no positive integer divisors other than 1 and the number itself.)
A Goldbach partition of an even number consists of a pair of primes which add up to the number. Some examples of partitions for a few numbers include:
6 =3 +3 8 =3 +5 10 = 3 + 7 = 5 + 5 12 = 7 + 5 100 = 3 + 97 = 11 + 89 = 17 + 83 = 29 + 71 = 41 + 59 = 47 + 53
Each even number has a partition count defined as the number of distinct ways it can be partitioned. For example the partition count for 100 is 6, for 10 it is 2.
Assignment
Write a C program which finds and prints the even number less than 1000, say k, which has the largest partition count. If there is more than one number with the same partition count, you just have to output the smallest of them.
Your program should output the number k together with its partition count.
It should also output the average value of the partition count for all even numbers less than 1000.
Then, your program should then output all the Goldbach partitions of the number k.
You must define and use a function to determine if a number is prime.
The prototype for the function should be: int isPrime (int);
This function takes an integer argument and returns 1 if it is a prime number and 0 otherwise.
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