我明白你的意思,但是分太少了.我花了不少时间.
function y=gassumption(n);
if mod(n,2);
error('This numeber is not an even.Please input again.')
elseif n<=6;
error('n must be larger than 6')
else
for i=1:n;
for k=i:n;
if (isprime(i))&(isprime(k))&(i+k==n);
y(1)=i;
y(2)=k;
break;
end;
end;
end;
end;
y;
通过测试,我试了几个数:
gassumption(20)
ans =
7 13
gassumption(50)
ans =
19 31
你小心点,别一次试太大的数,有一次我整了个1000,差点死机
温馨提示:答案为网友推荐,仅供参考