Cod sursa(job #1135525)

Utilizator Alex1199Alex Bercea Alex1199 Data 7 martie 2014 22:55:46
Problema Ciurul lui Eratosthenes Scor 100
Compilator fpc Status done
Runda Arhiva educationala Marime 0.36 kb
program p1;
var a:array[0..2000000] of boolean;
    f,g:Text;
    n,i,j,u,k:longint;
begin
assign(f,'ciur.in');reset(F);
assign(G,'ciur.out');rewrite(G);
readln(f,n);
for i:=2 to n do
        if a[i]=false then
                for j:=2 to n div i do a[i*j]:=true;
for i:=1 to n do
        if a[i]=false then inc(K);
writeln(G,k-1);
close(F);
close(G);
end.