Pagini recente » Cod sursa (job #2861099) | Cod sursa (job #1725273) | Cod sursa (job #460240) | Cod sursa (job #887809) | Cod sursa (job #2197086)
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("fractii.in");
ofstream out("fractii.out");
int main()
{
int n,i,j,e[1000001];
long long s;
cin>>n;
for(i=2;i<=n;i++)
{
e[i]=i;
}
for(i=2;i<=n;i++)
{
if(e[i]==i)
{
for(j=i;j<=n;j+=i)
{
e[j]=e[j]/i*(i-1);
}
}
}
s=1;
for(i=2;i<=n;i++)
{
cout<<i<<" "<<e[i]<<"\n";
}
out<<s;
return 0;
}