哥德巴赫猜想的题目是pascal类型的

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/29 09:43:05
哥德巴赫猜想的题目是pascal类型的

哥德巴赫猜想的题目是pascal类型的
哥德巴赫猜想的题目
是pascal类型的

哥德巴赫猜想的题目是pascal类型的
任何大于7的奇数都是三个素数之和.

原题:任何大于四的偶数是两奇素数之和。它是如此基础,楼上所说的只是它的一个推论罢了。

program sd;
var i,p,q:integer;
function pou(a:integer):boolean;
var j,n:integer;
begin
n:=0;
for j:=1 to a do
if a mod j=0 then
n:=n+1;
if n=2 then
po...

全部展开

program sd;
var i,p,q:integer;
function pou(a:integer):boolean;
var j,n:integer;
begin
n:=0;
for j:=1 to a do
if a mod j=0 then
n:=n+1;
if n=2 then
pou:=true
else
pou:=false;
end;
begin
readln(i);
if i mod 2<>0 then
begin
writeln('error');
halt;
end;
begin
p:=1;
repeat
p:=p+1;
q:=i-p;
until (pou(p)) and (pou(q));
writeln(i,'=',p,'+',q);
end;
end.

收起

program gedebahecaixiang;
var
x,z,b,k,i:longint;
begin
readln(x);(输入一个偶数)
for a:=2 to x-2 do
begin
k:=0;
for i:=2 to a-1 do
...

全部展开

program gedebahecaixiang;
var
x,z,b,k,i:longint;
begin
readln(x);(输入一个偶数)
for a:=2 to x-2 do
begin
k:=0;
for i:=2 to a-1 do
if k=0
then begin
b:=x-a;
k:=0;
for i:=2 to b-1 do
if b mod i=0 then k:=1;
if k=0
then writeln(x,'='.a,'+',b);
end;
end;
end.
(空格是为了你可以看清楚,不一定要打)

收起