Cod sursa(job #250070)
| Utilizator | Data | 30 ianuarie 2009 00:09:03 | |
|---|---|---|---|
| Problema | Fractii | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.55 kb |
#include <stdio.h>
int n,r,k,i,j,e,d,m,x,i1,a[100],l;
int main()
{
freopen("fractii.in","r",stdin);
freopen("fractii.out","w",stdout);
scanf("%d",&n);
k=n;
for(i=2;i<=n;i++)
{
i1=i;
j=2;
d=1;
l=0;
x=0;
while(i1>1)
{
e=0;
if(i1%j==0)
{
l++;
a[l]=j;
}
while(i1%j==0)
{
i1=i1/j;
}
j++;
}
for(j=1;j<=l;j++)
x=x+n/a[j];
k=k+(n-x);
}
printf("%d",k);
return 0;
}
