Your function will have one input and two outputs. The input is the even integer
ID: 1843679 • Letter: Y
Question
Your function will have one input and two outputs. The input is the even integer you would like to split into two primes. The two outputs are the prime integers that sum to the input. The first output should be the smaller prime number, and the second value is the larger prime number.
I just need help in getting the coding for this function started. The entire assignment is much longer, and it consists of modeling Goldbach's Conjecture in Matlab. For this function, the even integer (input) has to be greater than 2, and the two outputs have to print to the work space. Thanks!
Explanation / Answer
function count=goldbach_partition(n)
plist=primes(n);
np=n-plist(plist<=(n/2));
count=sum(member(np,plist));
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.