Var ar:array[1..n] of integer; ar2:array[1..n] of integer; i,k:integer;
function prost(a:integer):boolean; var i:integer; b:boolean; begin b:=true; for i:=2 to a div 2 do if a mod i=0 then begin; b:=false; break; end; if a=1 then b:=false; prost:=b; end;
begin; randomize; k:=0; for i:=1 to n do begin; ar[i]:=random(101); write(ar[i]:4); end; writeln; for i:=1 to n do if prost(ar[i]) then begin; inc(k); ar2[k]:=ar[i]; write(ar2[k]:4); end; end.
n=5;
Var
ar:array[1..n] of integer;
ar2:array[1..n] of integer;
i,k:integer;
function prost(a:integer):boolean;
var i:integer;
b:boolean;
begin
b:=true;
for i:=2 to a div 2 do
if a mod i=0 then
begin;
b:=false;
break;
end;
if a=1 then b:=false;
prost:=b;
end;
begin;
randomize;
k:=0;
for i:=1 to n do
begin;
ar[i]:=random(101);
write(ar[i]:4);
end;
writeln;
for i:=1 to n do
if prost(ar[i]) then
begin;
inc(k);
ar2[k]:=ar[i];
write(ar2[k]:4);
end;
end.
5591(20), 5623(16), 5639(23), 5641(16), 5647(22), - 4
5651(17), 5653(19), 5657(23), 5659(25), 5669(26), - 1
5683(22), 5689(28), 5693(23), 5701(13), 5711(14), - 3
5717(20), 5737(22), 5741(17), 5743(19), 5749(25), - 2
5779(28), 5783(23), 5791(22), 5801(14), 5807(20), - 4
5813(17), 5821(16), 5827(22), 5839(25), 5843(20), - 3
5849(26), 5851(19), 5857(25), 5861(20), 5867(26), - 3
5869(28), 5879(29), 5881(22), 5897(29), 5903(17), - 2
5923(19), 5927(23), 5939(26), 5953(22), 5981(23), - 2
5987(29), 6007(13), 6011(09), 6029(17), 6037(16), - 1
6043(13), 6047(17), 6053(14), 6067(19), 6073(16), - 2
6079(22), 6089(23), 6091(16), 6101(08), 6113(11), - 3
6121(10), 6131(11), 6133(13), 6143(14), 6151(13), - 2
6163(17), 6173(17), 6197(23), 6199(25), 6203(11), - 0
6211(10), 6217(16), 6221(11), 6229(19), 6247(19), - 2
6257(20), 6263(17), 6269(23), 6271(16), 6277(22), - 3
6287(23), 6299(26), 6301(10), 6311(11), 6317(17), - 2
6323(14), 6329(20), 6337(19), 6343(16), 6353(17), - 3
6359(23), 6361(16), 6367(22), 6373(19), 6379(25), - 2
6389(26), 6397(25), 6421(13), 6427(19), 6449(23), - 1
6451(16), 6469(25), 6473(20), 6481(19), 6491(20), - 3
6521(14), 6529(22), 6547(22), 6551(17), 6553(19), - 3
6563(20), 6569(26), 6571(19), 6577(25), 6581(20), - 3
6599(29), 6607(19), 6619(22), 6637(22), 6653(20). - 3
Всего 120 простых чисел, из них 57 имеют четную сумму цифр.