Cod sursa(job #714179)

Utilizator paul777Astalas Paul paul777 Data 15 martie 2012 15:08:23
Problema Ciurul lui Eratosthenes Scor 0
Compilator fpc Status done
Runda Arhiva educationala Marime 0.32 kb
var a:array[1..200000]of boolean;f,g:text;n,i,j,i2,nr,x:longint;
begin
assign(f,'ciur.in');reset(f);
assign(g,'ciur.out');rewrite(g);
for i:=1 to n do a[i]:=true;
for i:=2 to n do
if a[i]=true then for j:=2 to n div i do a[i*j]:=false;
x:=0;
for i:=2 to n do
if a[i]=true then x:=x+1;
write(g,x);close(f);close(g);end.