Pagini recente » Cod sursa (job #1663252) | Cod sursa (job #1752564) | Cod sursa (job #1009404) | Cod sursa (job #2717596) | Cod sursa (job #1156929)
#include <fstream>
using namespace std;
#define maxN 1000005
ifstream in("fractii.in");
ofstream out("fractii.out");
int n;
int getthem[maxN];
void reading()
{
in>>n;
}
void init_ciur()
{
int i;
for(i=1;i<=n;i++)
{
getthem[i]=i;
}
}
void lets_see()
{
int i,j;
for(i=2;i<=n;i++)
if(getthem[i]==i)
for(j=i;j<=n;j+=i)
{
getthem[j]=getthem[j]/i;
getthem[j]=getthem[j]*(i-1);
}
}
long long get_fractions_number()
{
long long number_of_fractions=1;
for(int i=2;i<=n;i++)
number_of_fractions+=1LL*getthem[i]*2;
return number_of_fractions;
}
int main()
{
reading();
init_ciur();
lets_see();
out<<get_fractions_number();
in.close();
out.close();
return 0;
}