Pagini recente » Cod sursa (job #1430238) | Cod sursa (job #1887617) | Cod sursa (job #2052818) | Cod sursa (job #420718) | Cod sursa (job #937367)
Cod sursa(job #937367)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("fractii.in");
ofstream fout("fractii.out");
int tot[1000005], n;
int main()
{
long long rez = 0;
fin >> n;
for(int i=2; i<=n; i++)
tot[i] = i;
for(int i=2; i<=n; i++){
if(tot[i] == i)
for(int j=i; j<=n; j += i)
tot[j] = tot[j]/i*(i-1);
rez += tot[i];
}
fout<<(rez*2)+1;
}