Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

2. Another unproven conjecture in number theory is the following: Let f: N N be

ID: 3812108 • Letter: 2

Question

2. Another unproven conjecture in number theory is the following: Let f: N N be dened by
f(n)=n/2 n even

3n+1 n odd;

then, for every n, there is an integer i such that fi(n) = 1. Verify that this conjecture is true for n = 22 andn = 23

1. Write a program that takes as input an even positive integer greater than 2 and writes it as a sum of two primes (Goldbach’s Conjecture).

2. Write a program that implements the function dened in Exercise 2.

3. Write a programthat takes a list of primes and gives as output the string of symbols that constitutes the corresponding G¨odel statement or recognizes that the list of primes is unacceptable.

Explanation / Answer

#include <stdio.h>
// Function to check prime number
int checkPrime(int n)
{
int i, isPrime = 1;

for(i = 2; i <= n/2; ++i)
{
if(n % i == 0)
{
isPrime = 0;
break;
}
}

return isPrime;
}
int main()
{
int n, i, flag = 0;
printf("Enter a positive integer: ");
scanf("%d", &n);
for(i = 2; i<= n/2; ++i)
{
// condition for i to be a prime number
if (checkPrime(i) == 1)
{
// condition for n-i to be a prime number
if (checkPrime(n-i) == 1)
{
// n = primeNumber1 + primeNumber2
printf("%d = %d + %d ", n, i, n - i);
flag = 1;
}
}
}
if (flag == 0)
printf("%d cannot be expressed as the sum of two prime numbers.", n);
return 0;
}
/*
output:
Enter a positive integer: 8
8 = 3 + 5
*/