language: Pascal (gpc) (gpc 20070904)
date: 105 days 22 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
program maxfact (input,output);
    var N , i, j ,m : integer;
        a : array [1..5000000] of boolean;
begin
    read(N);
    for i:=1 to N do a[i]:=true;
    m:=trunc(sqrt(N));
    for i:=2 to m do
       for j:=2 to m do a[i*j]:=false;
    for i:=1 to N do 
       begin
         if (a[i]=true) then write(i, ' ')
       end;    
end.