Program hotrotinhoc_hoc24;
var i,n: integer;
function nt(x: longint): boolean;
var j: longint;
begin
nt:=true;
if (x=2) or (x=3) then exit;
nt:=false;
if (x=1) or (x mod 2=0) or (x mod 3=0) then exit;
j:=5;
while (j<=trunc(sqrt(x))) do
begin
if (x mod j=0) or (x mod (j+2)=0) then exit;
j:=j+6;
end;
nt:=true;
end;
begin
write('Nhap n='); readln(n);
if nt(n) then writeln(N ,'la so nguyen to') else writeln(N,' khong phai so nguyen to');
write('Cac so nguyen to tu 0 den ',n,' la :');
i:=0;
while i<=n do
begin
i=sqr(trunc(sqrt(i))) then write(i,' ');
i:=i+1;
end;
writeln;
write('Cac so nguyen to tu 2 den ',n,' la :');
i:=2;
while i<=n do
begin
if nt(i) then write(i,' ');
i:=i+1;
end;
readln
end.
uses crt;
var n,i,kt,j,k,x:integer;
begin
clrscr;
write('nhap n='); readln(n);
if n>1 then
begin
i:=1;
repeat
i:=i+1;
until (n mod i=0) or (i=n);
if i=n then writeln(n,' la so nguyen to')
else writeln(n,' la hop so');
end;
writeln('Cac so chinh phuong trong khoang tu 0 toi ',n,' la: ');
j:=0;
repeat
if trunc(sqrt(j))=sqrt(j) then write(j:4);
j:=j+1;
until j=n+1;
writeln;
writeln('Cac so nguyen to trong khaong tu 0 toi ',n,' la: ');
if n>1 then
begin
k:=2;
repeat
x:=1;
repeat
x:=x+1;
until (k mod x=0) or (x=k);
if x=k then write(k:4);
k:=k+1;
until k=n+1;
end;
readln;
end.