哥德巴赫1+1猜想(Goldbach’s Conjecture)

1个回答

  • 完成填空后的程序如下:

    var

    i,j,k,n :integer;

    p,p1,p2 :boolean;

    begin

    i:=6; n:=0;

    while i<=100 do

    begin

    j:=3;

    p:=true;

    while (i-j>=3)and p do

    begin

    p1:=true;

    for k:=2 to j-1 do

    if j mod k=0 then p1:=false;

    if p1 then

    begin

    p2:=true;

    for k:=2 to i-j-1 do

    if (i-j)mod k=0 then p2:=false;

    if p1 and p2 then

    begin

    p:=false;

    n:=n+1;

    write(i:2,'=',j:2,'+',i-j:2,' ':4);

    if n mod 5=0 then writeln

    end

    else j:=j+2

    end

    else j:=j+2

    end;

    i:=i+2;

    end;

    end.