Cod sursa(job #51554)
| Utilizator | Data | 14 aprilie 2007 17:29:56 | |
|---|---|---|---|
| Problema | Fractii | Scor | 0 |
| Compilator | fpc | Status | done |
| Runda | Arhiva de probleme | Marime | 0.56 kb |
Var a:array [1..1000000] of byte;
f,g:text;
n,p,i,j,k,l,s:longint;
Begin
assign (f,'fractii.in');
assign (g,'fractii.out');
reset (f);
rewrite (g);
Readln (f,n);
For i:=1 to n do
begin
for j:=2 to trunc(sqrt(i)) do
if i mod j=0
then
begin
k:=k+1;
end;
if k=0
then
begin
a[i]:=1;
end;
end;
For i:=1 to n do
for j:=1 to n do
if ((a[i]=1) or (a[j]=1)) and (i<>j)
then
s:=s+1;
Writeln (g,s);
close(f);
close(g);
end.
