uses crt;
var i,x:integer;
function TinhTongUoc(x:integer);
var i:integer;
begin
for i:=2 to trunc(sqrt(x)) do
begin
if x mod i =0 then TinhTongUoc:=TinhTongUoc+i;
end;
end;
begin
clrscr;
Write('Nhap so n: ');readln(x);
write('Cac so hoan chinh tu 1 den ',x,' la: ');
for i:=1 to x do
begin
if TinhTongUoc(i)=i then write(' ',i,',');
end;
readln
end.