Pagini recente » Cod sursa (job #1433114) | Cod sursa (job #1259821) | Cod sursa (job #587926) | Cod sursa (job #1446420) | Cod sursa (job #937366)
Cod sursa(job #937366)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("fractii.in");
ofstream fout("fractii.out");
int main()
{
int tot[100005], n;
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;
}