Lời giải:
program hotrotinhoc;
var a: array[1..32000] of integer;
d,i,n,dc,dl,dnt: integer;
kc: real;
function nt(x: integer): boolean;
var i: integer;
begin
nt:=false;
if x<2 then exit;
for i:=2 to trunc(sqrt(x)) do
if x mod i=0 then exit;
nt:=true;
end;
begin
readln(n);
for i:=1 to n do
readln(a[i]);
kc:=(a[n]-a[1])/(n-1);
d:=0;
for i:=1 to n-1 do
for j:= i+1 to n do
if a[j]-a[i]=kc then inc(d);
if d=(n-1) then writeln('Day la so cap cong') else writeln('Day khong phai la so cap cong');
dc:=0; dl:=0;
for i:=1 to n do
begin
if a[i] mod 2=0 then inc(dc);
if a[i] mod 2=1 then inc(dl);
end;
writeln('So luong chan :',dc,' ; ','So luong le trong mang :',dl);
for i:=1 to n do
if nt(a[i]) then inc(dnt);
end;
write('So luong nguyen to :',dnt);
readln
end.